Exclude pages and posts based on custom field? (2 posts)

  1. Southbound
    Posted 6 years ago #

    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?

  2. richarduk
    Posted 6 years ago #

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

          $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

Topic Closed

This topic has been closed to new replies.

About this Topic