• I’m interning for newyorkminutemag.com/ and they are using an MVP theme called Devoe. There is a featured section containing 4 posts and a latest section containing 10. We have it setup to show 5 related posts at the bottom of the category pages. Posts do not show up until page 3 (only showing one) because it is trying to grab the posts already shown. Is there a way for me to Increment the $post variable by 14? I have gotten around them not showing up by adding 14 to $post->ID everywhere in the loop but it shows all the posts in the featured and latest categories until the last one on page 3 being unique. I have tried:
    global $post;
    $ID = $post->ID + 14;
    $post = get_post($ID);
    setup_postdata($post);

    and

    $ID = $post->ID;
    $ID += 14;
    $post->ID = $ID;

    both will not assign $post a new value it seems.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    If you’re using wp_query to get the posts, look at the “offset” argument.

    Do not use post IDs as the counter; that’s a database field, not a counter.

    Thread Starter mrlambdas

    (@mrlambdas)

    I can’t even tell how the theme is querying the posts. I’ve done work with PHP before (mysqli), I am struggling to find out how these WP queries are being executed. This is one of the 5 posts per page, I can’t tell where it is getting have_posts() or in_array.

    <?php global $do_not_duplicate; if (isset($do_not_duplicate)) { if (have_posts()) : while (have_posts()) : the_post(); if (in_array($post->ID + 14, $do_not_duplicate)) continue; ?>
    
    <li class="infinite-post">
    
    <?php if (  (function_exists('has_post_thumbnail')) && (has_post_thumbnail())  ) { ?>
    
    <div class="archive-list-img left relative">
    
    <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>">
    
    <?php the_post_thumbnail('medium-thumb'); ?>
    
    <?php global $numpages; if(get_post_meta($post->ID + 14, "mvp_video_embed", true)) { ?>
    
    <div class="feat-video">
    <i class="fa fa-video-camera fa-2"></i>
    </div><!--feat-video-->
    
    <?php } else if ( $numpages > 1 ) { ?>
    
    <div class="feat-gallery">
    <i class="fa fa-camera-retro fa-2"></i>
    </div><!--feat-gallery-->
    <?php } ?>
    </a>
    </div><!--archive-list-img-->
    <div class="archive-list-text left relative">
    <a href="<?php the_permalink(); ?>" rel="bookmark">
    <?php the_title(); ?></a>
    
    <p><?php echo excerpt(22); ?></p>
    
    <div class="archive-list-info left relative">
    
    <span class="archive-list-author left">
    <?php the_author(); ?></span>
    <span class="archive-list-date left"><?php the_time(get_option('date_format')); ?></span>
    
    </div><!--archive-list-info-->
    
    </div><!--archive-list-text-->
    
    <?php } else { ?>
    
    <div class="archive-list-text left relative w100">
    
    <a href="<?php the_permalink(); ?>" rel="bookmark">
    <?php the_title(); ?></a>
    
    <p><?php echo excerpt(22); ?></p>
    
    <div class="archive-list-info left relative">
    
    <span class="archive-list-author left">
    <?php the_author(); ?></span>
    <span class="archive-list-date left"><?php the_time(get_option('date_format')); ?></span>
    
    </div><!--archive-list-info-->
    
    </div><!--archive-list-text-->
    
    <?php } ?>
    
    </li>
    
    <?php endwhile; endif; } else { ?>

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    As this is a paid/commercial theme, you should check with the developers to see how / why they built it the way the did and how you can customize it. Their support is at https://www.mvpthemes.com/support/

    Thread Starter mrlambdas

    (@mrlambdas)

    I originally was going to, but after 6 months they do not offer support (1 year if paid for). I thought I would check here if there was a simple way to set the post variable.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Increment $post’ is closed to new replies.