WordPress.org

Ready to get started?Download WordPress

Forums

Page Navigation: checking for value of meta_key (2 posts)

  1. nrrghh
    Member
    Posted 5 years ago #

    hi

    looking to use wp as a CMS

    site will have sections containing 3-4 common page templates

    code below lets me limit side navigation based on meta_key value
    <?php wp_list_pages('meta_key=section&title_li=<h2>Section Pages</h2>' ); ?>

    how can I test for the meta_key value?

    thanks

    Mark

  2. nrrghh
    Member
    Posted 5 years ago #

    hi

    some progress

    discovered get_post_custom_keys

    code below gets the value of meta_key to then filter what Pages are shown in side nav

    I imagine this could be done in a slightly more elegant manner...

    <?php
    $custom_field_keys = get_post_custom_keys();
    foreach ( $custom_field_keys as $key => $value )
    if ($key < 1 ) $var = $value;
    wp_list_pages("meta_key=$var&title_li=<h2>$var Pages</h2>" );
    ?>

    Mark

Topic Closed

This topic has been closed to new replies.

About this Topic