Skip to content

How to show related content for future post #290

Open
@delyankotsev

Description

@delyankotsev

Hi, first, thanky you for this amazing plugin. I have one question, how to show all related posts in single, when is set to shedule. If I Publish the post everything is fine, but if is not published and is set to shedule, related content doesnt show.

This is code I use:

                        // Find connected pages
                        $connected = new WP_Query( array(
                            'connected_type' => 'posts_to_pages',
                            'connected_items' => get_queried_object(),
                            'nopaging' => true,
                            'post_status' => array('publish','future'),
                        ) );

                        // Display connected pages
                        if ( $connected->have_posts() ) :
                        ?>
                        <ul class="submenu">
                        <?php while ( $connected->have_posts() ) : $connected->the_post(); ?>
                            <li><a href="<?php the_permalink(); ?>"><?php $post_type = get_post_type_object( get_post_type($post) ); echo $post_type->label ; ?></a> </li>
                        <?php endwhile; ?>
                        </ul>

                        <?php 
                        // Prevent weirdness
                        wp_reset_postdata();

                        endif;

Thank you in advance :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions