• Sourav Pan

    (@microbiologynote)


    I want to display a custom loop of top liked posts in my homepage, how can i create this custome post loop?

Viewing 1 replies (of 1 total)
  • Thread Starter Sourav Pan

    (@microbiologynote)

    I want this to implement within my index.php file manually, without any short code.
    Here is an example of custome post loop, i want to show top liked post using this loop, how i can do this?

    `<?php
    $loop = new WP_Query( array( ‘post_type’ => ‘property’, ‘category_name’ => ‘current’, ‘ignore_sticky_posts’ => 1, ‘paged’ => $paged ) );
    if ( $loop->have_posts() ) :
    while ( $loop->have_posts() ) : $loop->the_post(); ?>
    <div class=”pindex”>
    <?php if ( has_post_thumbnail() ) { ?>
    <div class=”pimage”>
    <a href=”<?php the_permalink(); ?>”><?php the_post_thumbnail(); ?></a>
    </div>
    <?php } ?>
    <div class=”ptitle”>
    <h2><?php echo get_the_title(); ?></h2>
    </div>
    </div>
    <?php endwhile;
    if ( $loop->max_num_pages > 1 ) : ?>
    <div id=”nav-below” class=”navigation”>
    <div class=”nav-previous”><?php next_posts_link( __( ‘<span class=”meta-nav”>←</span> Previous’, ‘domain’ ) ); ?></div>
    <div class=”nav-next”><?php previous_posts_link( __( ‘Next <span class=”meta-nav”>→</span>’, ‘domain’ ) ); ?></div>
    </div>
    <?php endif;
    endif;
    wp_reset_postdata();
    ?>`

    • This reply was modified 2 years, 6 months ago by Sourav Pan.
    • This reply was modified 2 years, 6 months ago by Sourav Pan.
Viewing 1 replies (of 1 total)
  • The topic ‘Custome loop of top liked post’ is closed to new replies.