Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Center area post/pages (http://forum.bytesforall.com/forumdisplay.php?f=32)
-   -   Add "customer field" after 1st post on multi post page (http://forum.bytesforall.com/showthread.php?t=16101)

fantasy Nov 26, 2011 02:54 AM

Add "customer field" after 1st post on multi post page
 
Hi all,
I wants to add some customer text (ex: advertisement code or URL or text) between 1st post and 2nd post on multi post page.(I want this text "only" display after 1st port, not display on 2nd, 3rd....etc posts).

I add the following code in the index.php file.
Code:

<?php if ($wp_query->current_post == 0) : ?>
www.bonjour-travel.com
<?php endif; ?>

After I added this code, I can see this text displayed correctly(you can see it only display after 1st post, ex: www.bonjour-travel.com), but if I enter any post (single post page), this txt also displayed after the article (you can refer to : http://www.bonjour-travel.com/archives/2096) , but I just want this text only displayed on my first page (multi-post page), and don't displayed on single page
Any one knows how to modify the code? Thanks in advance!

My homepage: www.bonjour-travel.com
Atahualpa: 3.7.3
Wordpress: 3.2.1

juggledad Nov 26, 2011 04:56 AM

try adding an OR to your IF and check for the front page

fantasy Nov 26, 2011 07:21 AM

Thanks for the reply but I still can not get it works.
Is nay one can help to point out how to modify the code?
Thanks!

juggledad Nov 26, 2011 07:35 AM

what code did you try? display it here and maybe I can see the error you made.

fantasy Nov 28, 2011 07:08 AM

Thanks! juggledad
I am not familiar with the php code and following is my code:

Code:

<?php is_front_page(); ?>
<?php if ($wp_query->current_post == 0 ) : ?>www.bonjour-travel.com<?php endif; ?>


juggledad Nov 28, 2011 08:00 AM

You might want to read up on 'conditionals - http://www.w3schools.com/php/php_operators.asp

fantasy Nov 28, 2011 08:45 AM

did you mean:
Code:

<?php is_front_page(); ?> && <?php if ($wp_query->current_post == 0 ) : ?>www.bonjour-travel.com<?php endif; ?>
But it still can not works for me,
Thanks!

juggledad Nov 28, 2011 10:33 AM

try this
HTML Code:

<?php (is_front_page() && ($wp_query->current_post == 0 )) : ?>www.bonjour-travel.com<?php endif; ?>


All times are GMT -6. The time now is 04:47 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.