• Hello, I’ve been looking for a way to display related child pages on a current child page using custom fields, as shown here: Doorway | Nick Menn – Goon Road.

    As you can see from the link, after three hours of toiling, I finally got a desirable result (on the right side under the download link). Unfortunately on certain pages such as this that has one meta key defined by two to six different values: Doorway | RT-FaQ & Nick Menn – The RT and WO Show I have an issue with it not showing all of the pages. It’ll only show Nick Menn’s pages.

    To clarify, the custom fields have at least two fields with the same key (name) and a different specific value. In this case, I made two fields for this page since there are two artists, Nick Menn & RT-FaQ.

    List of fields on this page:
    artist > Nick Menn
    artist > RT-FaQ

    albumlink > https://#

    The markup used to generate the related child pages:

    <?php $field_name="artist"; $field_value = get_post_meta($post->ID, $field_name, true); ?>
    <?php $thumb_menu = new Thumbnail_walker(); ?>
    <?php wp_list_pages( array(
    	'title_li' => '<h2 class="has-title text-center">Related Albums</h2>',
    	'child_of' => 27,
    	'meta_key' => 'artist',
    	'meta_value' => $field_value,
    	'walker' => $thumb_menu
    ) ); ?>

    It is only generating Nick Menn’s pages. How can I get RT-FaQ’s pages to generate as well?

    Keep in mind, I had to set the fields that way due to generating those album pages on the artist’s slides, as shown here: Doorway | Bios

  • The topic ‘One meta key, multiple meta values’ is closed to new replies.