I have very long posts so they have to be divided into two parts, which means two posts on one topic. The second part must be hidden from the eyes.

I have a post ids to exclude. Is it possible to do this through these code?

function wi_post_ids_exclude(){
    $post_ids_exclude = array();
    $exc_query = new WP_Query( array( 'post_type' => 'portfolio', 'meta_key' => '_wi_exclude-from-loop', 'meta_value' => '1' ) );
    while ($exc_query->have_posts()) : $exc_query->the_post();
      $post_ids_exclude[] = get_the_ID();
    return $post_ids_exclude;

and prev/next links

 <?php if(is_single()){ ?>
        <div class="post-nav-wrapper">
                $previous_post = get_previous_post(  );
                <a href="<?php echo esc_url(get_permalink($previous_post->ID)); ?>" class="post-nav post-nav-next">
                <span><?php esc_html_e('Previous Post', 'ecko'); ?></span>
                <h4 class="post-title"><?php echo get_the_title($previous_post->ID); ?></h4>
            <?php } ?>
                $next_post = get_next_post(  );
                <a href="<?php echo esc_url(get_permalink($next_post->ID)); ?>" class="post-nav post-nav-previous">
                <span><?php esc_html_e('Next Post', 'ecko'); ?></span>
                <h4 class="post-title"><?php echo get_the_title($next_post->ID); ?></h4>
              <?php } ?>
     <?php } ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.