• Resolved ?sa

    (@asabo)


    Hi,
    Thanks for a great plugin. I have finally been able to create a list of child posts in the widget area. But I would like the parent post to show as well. Is that possible?
    Regards, ?sa

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Thread Starter ?sa

    (@asabo)

    Never mind, I solved it. I used following shortcode:
    [display-posts post_type=resedagbok taxonomy=resa tax_term=current exclude_current=false order=ASC]

    combined with a code snippet in functions.php to only show parents on the archive page (but show all in admin UI):
    function mf_show_travel_books( $query ) {

    if ( ! is_admin() && $query->is_post_type_archive(‘resedagbok’) ) {

    // this line tells it to ONLY return parent items
    $query->set( ‘post_parent’, 0 );
    }
    }
    add_action( ‘pre_get_posts’, ‘mf_show_travel_books’ );

Viewing 1 replies (of 1 total)
  • The topic ‘Show current parent and it’s children’ is closed to new replies.