Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author Hector Cabrera

    (@hcabrera)

    Check the documentation of the time_quantity parameter (Settings > WordPress Popular Posts > Parameters), you’ll find a full example there that you can use to set up your shortcode.

    Thread Starter therealwebguru

    (@therealwebguru)

    all i see popular posts BUT am asking for trending posts
    maybe you should have more stuffs explaining trending posts

    so is popular treated as trending with time duration?

    Thread Starter therealwebguru

    (@therealwebguru)

    also i don’t understand what the shortcode should be
    am looking for what i can paste somewhere on the webpage to display the trending posts to me

    With wpp_get_mostpopular():
    
    <?php
    $args = array(
        'range' => 'custom',
        'time_quantity' => 1,
        'time_unit' => 'hour'
    );
    
    wpp_get_mostpopular( $args );
    ?>
    
    With the [wpp] shortcode:
    
    [wpp range='custom' time_quantity=1 time_unit='hour']
    Plugin Author Hector Cabrera

    (@hcabrera)

    You literally have it right in front of your eyes:

    [wpp range='custom' time_quantity=1 time_unit='hour']

    Edit:

    so is popular treated as trending with time duration?

    Yep, that’s exactly it.

    Thread Starter therealwebguru

    (@therealwebguru)

    wait all i need to paste is this?

    [wpp range='custom' time_quantity=1 time_unit='hour']

    did that and it just displays this as text
    [wpp range=’custom’ time_quantity=1 time_unit=’hour’]

    Plugin Author Hector Cabrera

    (@hcabrera)

    wait all i need to paste is this?

    Yep. That’s the shortcode you were asking about.

    did that and it just displays this as text
    [wpp range=’custom’ time_quantity=1 time_unit=’hour’]

    Where did you paste that exactly? Also, is the plugin currently active?

    Thread Starter therealwebguru

    (@therealwebguru)

    ok here is what i used and it works

    <?php
    $args = array(
        'range' => 'custom',
        'time_quantity' => 1,
        'time_unit' => 'hour'
    );
    
    wpp_get_mostpopular( $args );
    ?>

    How do i control how many of the trending posts show up?
    Like if there a like 15 posts under trending in admin panel but i only want to show the top 10?

    Plugin Author Hector Cabrera

    (@hcabrera)

    Easy, use the limit parameter:

    <?php
    $args = array(
        'limit' => 10,
        'range' => 'custom',
        'time_quantity' => 1,
        'time_unit' => 'hour'
    );
    
    wpp_get_mostpopular( $args );
    ?>

    You’ll want to take a closer look at the documentation so you can learn everything you can do with the plugin.

    If you have any further questions feel free to ask. For the time being, since the original question has been answered, I’m marking this topic as resolved.

    Thread Starter therealwebguru

    (@therealwebguru)

    one last question

    what exactly is this and what is it used for or where does one paste this?

    [wpp range='custom' time_quantity=1 time_unit='hour']

    AND

    how do i add style to the output…i will like to add thumbnails and also will like to remove the pageview counts that shows up in the output

    Thanks!

    Plugin Author Hector Cabrera

    (@hcabrera)

    what exactly is this and what is it used for or where does one paste this?

    That’s a WordPress Shortcode.

    how do i add style to the output…i will like to add thumbnails and also will like to remove the pageview counts that shows up in the output

    Please check the documentation (Settings > WordPress Popular Posts > Parameters). You’ll find all available parameters there, including those you need to do the things you want to do (display thumbnails, hide the views count, etc).

    If you want to apply some custom CSS to your popular posts list, then maybe this can help get you started.

    Thread Starter therealwebguru

    (@therealwebguru)

    there you go
    the link helps

    thanks again

    Thread Starter therealwebguru

    (@therealwebguru)

    ok i tried the styling and am not getting the thumbnail still

    {thumb} (returns thumbnail linked to post/page, requires thumbnail_width & thumbnail_height)

    but i don’t see in doc where it shows how to use thumbnail_width & thumbnail_height

    also how does {thumb} retrieve the thumbnail or how does it know how to get it from?

    Plugin Author Hector Cabrera

    (@hcabrera)

    As the documentation states (Settings > WordPress Popular Posts > Parameters), in order to display the thumbnail you need to pass the thumbnail_width and thumbnail_height parameters.

    Here’s a basic example, extracted from the documentation itself:

    <?php
    $args = array(
        'thumbnail_width' => 30,
        'thumbnail_height' => 30
    );
    
    wpp_get_mostpopular( $args );
    ?>

    If we include the parameters from before, then it becomes:

    <?php
    $args = array(
        'limit' => 10,
        'range' => 'custom',
        'time_quantity' => 1,
        'time_unit' => 'hour',
        'thumbnail_width' => 30,
        'thumbnail_height' => 30
    );
    
    wpp_get_mostpopular( $args );
    ?>

    The shortcode version of that would be:

    [wpp limit=1 range='custom' time_quantity=1 time_unit='hour' thumbnail_width=30 thumbnail_height=30]

    Plugin Author Hector Cabrera

    (@hcabrera)

    also how does {thumb} retrieve the thumbnail or how does it know how to get it from?

    Please check this FAQ: How does WordPress Popular Posts pick my posts’ thumbnails?

    Thread Starter therealwebguru

    (@therealwebguru)

    can i use an existing thumbnail function already with dimensions?

    like this <?php the_post_thumbnail('post_thumb'); ?>

    also would have been great if one can post php inside the post_html key

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘shortcode to get trending topic withing past 6 hours’ is closed to new replies.