WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. Southbound
    Member
    Posted 5 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
    Member
    Posted 5 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic