If you mean the “next/prev posts” – that’s your index, too!
Only not showing 999 posts, only the number set in your Options > Reading.
The Codex is down atm but I remember something is_paged (or similar, I am not a coder!) and that is referring exactly to your situation.
Thread Starter
wcp
(@wcp)
yea seems the is_paged has to do with it im now looking at http://codex.wordpress.org/Conditional_Tags
As i said i only want something to show in the index page, i mean like this:
domain.com/index.php
I know they call the the next/prev post pages also the ‘front page’ but it isn’t the index page since every site has only one main index page. The next/prev post pages look like this:
domain.com/page/2/index.php
So these are not the main index page.
im now looking into the conditional tags page to see if i can find anything i can use.
Thread Starter
wcp
(@wcp)
I thought a combination code with is_home and is_paged would work but im not a php guy… on the paged pages it just shows the home text too… somebody help!
I am not a coder either, but the “combination” should tell WP to display your text when it is home but is NOT paged.
Thread Starter
wcp
(@wcp)
moshu, thanks alot for the pointer man, i found it 🙂
it seems that the ‘exclude’ command after the ‘if’ command is ‘&&!’, so this is the code I used:
<?php if ( (is_home())&&!(is_paged()) ){ ?>
<h1>Welcome to my site, etc. etc.</h1>
<?php } ?>
And it works perfectly. Reminder for others looking for the same: Check the extra set brackets around ‘is home but not is paged’ part, those are mandatory for it to work.
This should work just as well. Bit simpler.
if (is_home() && !is_paged())
It’s not an “exclude”. It’s an “AND” and a “NOT”. Boolean logic.
I think the correct way to say it is
&& = AND
! = NOT
Thread Starter
wcp
(@wcp)
yea you’re both right, & otto that simplified code does indeed work like a charm too.
Thanks.
I’m using WP v2.1.2 and the conditional is_home no longer works for v2.1 and above. More info is here
I have my a static page called Home, which I set as my front page and I’ve put the code below inside the body element on my index page.
<?php
if (is_page('Home'))
{
echo 'Home returned true';
}
else
{
echo 'Home returned false';
}
?>
Works well.