WordPress.org

Forums

WordPress Popular Posts
[resolved] show plugin with out widget (11 posts)

  1. Erik
    Member
    Posted 2 years ago #

    Hi!

    great plugin!

    But I like to show this data with out the widget. And also like to get the title and images in my order.. I am doing it like this now:

    <ul id="featured-post">
    					<?php $pc = new WP_Query('order_by=views&posts_per_page=5'); ?>
    
    					<?php while ($pc->have_posts()) : $pc->the_post(); ?>
    					<li>
    						<div><a href="<?php the_permalink() ?>"><?php the_post_thumbnail(array()); ?></a></div>
    						<h4>
    
    <?php
    $current_post_categories = get_the_category(); // store category objects for current post in an array
    foreach( $current_post_categories as $category) {
    
       echo '<a href="'.get_option('home').'/category/'.$category->cat_name.'">'.$category->cat_name.'</a>';
    
    }
    ?>
    
    </h4>
    						<h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2><h3><?php echo excerpt(15); ?></h3> <a href="<?php the_permalink() ?>">läs mer</a>
    
    					</li>
    
    					<?php endwhile; ?>
    				</ul>

    I like it to show most views of a week. But it do not work.

    please help!

    Best regards,
    Erik

    http://wordpress.org/extend/plugins/wordpress-popular-posts/

  2. Héctor Cabrera
    Member
    Plugin Author

    Posted 2 years ago #

    Hi Erick,

    Please check both FAQ and Installation sections, there you'll find info on alternatives to the widget version of the plugin.

  3. Erik
    Member
    Posted 2 years ago #

    Hi Héctor!

    Yes I have looked at them. But they do not show how to make it in a loop with this elements:

    <?php the_post_thumbnail(array()); ?>
    <?php the_title(); ?>
    and more

    so I can make the listing in the way I like. I can't find an example of this anywhere.

    Thanks!

  4. Héctor Cabrera
    Member
    Plugin Author

    Posted 2 years ago #

    I'm sorry, I don't understand. Can you elaborate more, please? What exactly do you want to do?

  5. Erik
    Member
    Posted 2 years ago #

    Sorry about my english :) Will try to make it more clear.

    To list post in wordpress, wordpress has an php loop. I like to do this with this plugin. So I can build the contant exacly as I like. It will make so I got more control over the content.

    Best regards,
    Erik

  6. Héctor Cabrera
    Member
    Plugin Author

    Posted 2 years ago #

    I see. Well, there's an option for that too ;) You can customize the HTML structure by using the wpp_start, wpp_end, post_start and post_end parameters with the wpp_get_mostpopular() template tag. You can find more info about these (and other parameters) on your wp-admin > Settings > WordPress Popular Posts > FAQ page.

  7. Erik
    Member
    Posted 2 years ago #

    Great! Thanks!

    Just one more question. I am just a PHP beginner, can you show how this loop look like. Sorry for this, but it would help me super much!

    Best regards,
    Erik

  8. Héctor Cabrera
    Member
    Plugin Author

    Posted 2 years ago #

    No problem, here's an example:

    <?php
    
    if ( function_exists('wpp_get_mostpopular') ) {
      wpp_get_mostpopular( 'wpp_start=<ol>&wpp_end=</ol>&post_start=<li>&post_end=</li>&do_pattern=1&pattern_form="{thumb} {title} - {stats}"' );
    }
    
    ?>
  9. Erik
    Member
    Posted 2 years ago #

    Thanks!

    We are almost there :)

    where it says "{thumb} {title} - {stats}"

    is it possible to make it more changeable?

    I am making an RSS feed with the most popular post in a week. And I like to be able to have other tags then the ones find in {title} and so on. So it would be great to beable to use standard wordpress calles for title, tumbnail, content and so on. like this:

    <a href="<?php the_permalink() ?>"><?php the_post_thumbnail(array()); ?></a>
    <a href="<?php the_permalink() ?>"><?php the_title(); ?></a>
    <?php echo excerpt(15); ?>
    <a href="<?php the_permalink() ?>">read more</a>

    I am crossing my fingers that this is possible. It would be great it mean I can make the RSS feed and a widget style just the why I like it to look and work.

    Best regards,
    Erik

  10. Héctor Cabrera
    Member
    Plugin Author

    Posted 2 years ago #

    At the moment, no. However, I'm planning to modify the custom HTML feature for more flexibility - it might be included in the next release or the one after.

  11. Erik
    Member
    Posted 2 years ago #

    oh no.. Ok it would be a great addition to the plugin.
    Really hopping for this update as soon as possible.

    Best regards,
    Erik

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WordPress Popular Posts
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.