Page ID problem
-
This has had me tearing my hair out for the last 2 days, I’m creating a (partially) dynamic footer element, basically there are 3 different events, each has it’s own set of sponsors and accompanying logos that i want to display on the relevant event page’s footer.
now I’ve set up the following (pretty ugly I know:
if ( is_page('230') || $post->post_parent == '230' ) { echo "some things"; } elseif ( is_page('20') || $post->post_parent == '34' ) { echo "some more things"; } elseif ( is_page('122') || $post->post_parent == '39' ) { echo "some other stuff"; } else { echo "blah blah blah"; } ?>The problem is that on each of the ‘main’ event pages the relevant footer element isn’t showing, they show the ‘else’ element. The weird thing is that each of the children pages of the events are showing the correct footer element for ‘their’ event.
To complicate the issue the page ID that I am getting via the admin pages for the ‘parent’ event pages is different from that produced by printing the_ID() – but still neither the admin ID or the ID printed by the_ID() forces the event pages to show the correct footer element.
And the last little bit of weirdness is that each ‘parent’ event page has its own template file, so I thought to circumvent the page ID weirdness i’d just use
if (is_page_template('whatever-page-template.php')but that doesn’t work either.It seems for some reason that these ‘parent’ event pages aren’t recognising themselves properly.
Does anyone have any idea what might be causing this, I’m at a complete loss?
The topic ‘Page ID problem’ is closed to new replies.