need to get post and/or page ID – need input on php code
-
I am writing some php code for header and footer sections using an if statement to decide if a section of code gets executed or does not. I never wrote php before.
Can someone look at my code and tell me why it’s not working?
<!– set list of specific post and/or page id’s in an array called $cl –>
<?php $cl == array(4708, 4534, 4533, 4531, 4530, 4529, 4528, 4832, 4833, 4666, 4665, 4659, 4657); ?>
<!– if NOT post-or-page-ID in $cl then “SHOW THIS” –>
<?php if (!in_array($post->ID, $cl)) : ?>
show this
<?php : ?>I want to compare the page or post ID with a list of ID’s and use an if statement to determine is ID exists or not in the list.
This below php if statement code was working for me except it only worked on page ID’s and not post ID’s.
- The topic ‘need to get post and/or page ID – need input on php code’ is closed to new replies.