• Hi,

    I’ve got WP 2.5.

    And I have a page on my web site called ‘Career Development’, currently accessed by index.php?page_id=30. So I’ve added the following to my sidebar, so that if I’m on that page, the link will be bold…..except it doesn’t work ??

    <?
    if (is_page(array(30,'career-development','Career Development'))) {
    	echo '<li class="bold"><a href="index.php?page_id=30">Career Development</a></li>';
    } else {
    	echo '<li><a href="index.php?page_id=30">Career Development</a></li>';
    }
    ?>

    I obviously have a .bold {font-weight:bold} in my CSS.

    It works for my is_category() if statements, but just not this ??

    Can anyone make any suggestions why it isn’t working?

    Many thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter sincewelastspoke

    (@sincewelastspoke)

    Hate to *bump*, but any ideas anyone?

    Thanks for your time.

    Are 30, ‘career-development’, and ‘Career Development’ all the same page? If so, then this is an error, and you only need one and shouldn’t use an array. I just noticed your permalinks, so I’d use 30 of the three choices.

    Thread Starter sincewelastspoke

    (@sincewelastspoke)

    Thanks for the reply ?? Yes, they’re all the same page.

    page_id = 30
    page-slug = career-development
    page-title = Career Development

    I used the array just to future proof it. Right now we’re using index.php?page_id=30 but in the future plan to change the htaccess/rewrite engine so it uses the page title ‘Career Development’.

    So you reckon just use if (is_page(’30’)) { for now ?

    Thanks.

    Yes, the ID works even if you have pretty permalinks.

    Thread Starter sincewelastspoke

    (@sincewelastspoke)

    Aaaah cool, I’ll just use the ID then. Fingers crossed ??

    Thread Starter sincewelastspoke

    (@sincewelastspoke)

    Brilliant, that worked.

    Maybe I should have stuck with the ID instead of trying to be smart hehe.

    Thanks again!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘2.5 is_page(array… issues :(’ is closed to new replies.