Support » Fixing WordPress » using is_page() and child_of= in conditional statement?

  • 2.21, specifically.

    I am wondering if there is a way to use the child_of= parameter in the is_page() function?

    something like:

    if (is_page('child_of=10')) {
    some stuff to do; }
    else {}

    I’m trying to find a way to add the parent page (and its permalink) to the title before the current page’s title. Not all pages are child pages, of course.

    I can set up this:

    if (is_page(3)) {
    echo c2c_get_custom('heading-tagline','<h2>Affirmative Action Consulting</h2><p>','</p>','');
    elseif (is_page(10) || (11) || (12) || (13)) {
    the_title('<h2><a href="/consulting-services/" title="Consulting Services">Consulting Services</a>','</h2>');
    echo c2c_get_custom('heading-tagline','<p>','</p>','');
    elseif (is_page(14)) {
    the_title('<h2><a href="/resource-center/" title="Resource Center">Resource Center</a>','</h2>');
    echo c2c_get_custom('heading-tagline','<p>','</p>','');
    else {
    echo c2c_get_custom('heading-tagline','<p>','</p>','');

    but the added “Consulting Services” is added everywhere except on the homepage – weird. If I just use one page in the second if statement (to add Consulting Services) it works as expected, only adding it to the actual page, not others…

    I guess I am wondering why it doesn’t work using the standard method of testing for several page ids per my second example.

    any ideas? maybe I am just messing up the syntax or something but I’ve stared at this and messed with it and cannot see the faults.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘using is_page() and child_of= in conditional statement?’ is closed to new replies.