• This doesn’t work!

    <?php
    $topNavigationParentID = 3;
    $navigationlist = wp_list_pages('title_li=&echo=0&depth=1&child_of=$topNavigationParentID');
    ?>

    But this works well!

    <?php
    $navigationlist = wp_list_pages('title_li=&echo=0&depth=1&child_of=3');
    ?>

    It seems like WordPress ignores custom variables?! No way!

    Help please

Viewing 2 replies - 1 through 2 (of 2 total)
  • That’s because variables are treated as literal text in single quotes..

    Try..

    wp_list_pages("title_li=&echo=0&depth=1&child_of=$topNavigationParentID");

    or

    wp_list_pages('title_li=&echo=0&depth=1&child_of='.$topNavigationParentID);

    Thread Starter ikramy

    (@ikramy)

    Thanks; it works now ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WP is ignoring a custom variable !’ is closed to new replies.