Support » Fixing WordPress » Exclude pages and posts based on custom field?

  • Southbound

    (@southbound)


    I’m adding a custom field to my pages and posts to be able to filter them based on which domain you’re at (this is a multi-domain and multi-language site). I know how to get the domain name, but how do I use this variable with wp_list_pages() and the post loop?

Viewing 1 replies (of 1 total)
  • richarduk

    (@richarduk)


    I’m no php expert, but this might get the ball rolling

    <?php
          $blah = get_post_meta($post->ID, "page-description", true);
          if ($blah !=='')
        { wp_list_pages('title_li=')};
    ?>

    where page-description is your custom field name

    wp_list_pages is used outside the loop

Viewing 1 replies (of 1 total)
  • The topic ‘Exclude pages and posts based on custom field?’ is closed to new replies.