either try:
if( in_array($post->ID, array(1,2,3,4,5,6)) ) {
then do somethign
}
http://php.net/manual/en/function.in-array.php
or, if you really mean a static page:
if( is(page( array(1,2,3,4,5,6) ) ) {
then do somethign
}
http://codex.wordpress.org/Function_Reference/is_page
Thanks for your reply.
I’ve tried your code but it doesn’t seem to work.
<?php if( in_array($post->ID, array(1,2,3,4,5,6)) ) { ?>
The parameter would be posted like this:
http://www.mharrisweb.co.uk/?p=1
If p = 1 then do something
Can you please help?
Thanks again
[Please post code snippets between backticks or use the code button.]
you could try:
<?php if( in_array( get_query_var('p'), array(1,2,3,4,5,6)) ) { ?>
details might depend on where in the code of which template of your theme you are trying to use the if statement.
Thanks again for your reply.
Still does not action.
Im editing index.php, I just need to change the code depending upon which page is requested.
Anymore ideas?
Thanks again.
Im editing index.php, I just need to change the code depending upon which page is requested.
can you paste the full code of index.ph into a http://pastebin.com/ and post the link to it here?
and also indicate which line(s) you are trying to modify?
are you testing for posts or pages?
what is the output if you add a few test lines before line 3:
example:
<?php
echo 'post/page-ID: '.$post->ID.'<br/>';
if( is_single() ) echo 'post-ID: '.get_query_var'p').'<br/>';
if ( is_page() ) echo 'page-ID: '.get_query_var('page_id').'<br/>';
?>
does your theme have a single.php and/or page.php?
maybe you need to add the code there?