Support » Plugin: Special Recent Posts » Only Limited Number Of Posts Show

  • gormley


    It seems there is a limit of either 8 or 9 recent posts that the script will display.

    After offsetting for the front page posts at 10 it only shows the next 8 or 9 in a random rotation.

    How do you get the plugin to pull from all posts or at least set the parameter for how many recent posts to pull from… e.g. last 30 posts.

Viewing 15 replies - 1 through 15 (of 18 total)
  • romanpicisan


    Where did you put the widget dude? Is it in a theme template? If so, allow me to explain a little bit about that custom code.

    // Defining widget options.
    $args = array(
        'post_limit'       => 5,
        'post_random'      => 'yes',
        'category_include' => 1,2,4,5,7
    // Function call.

    You can actually customize the array as you like. The options are below:

    // Change widget title (default: 'special recent posts')
    'widget_title' => text
    // Display thumbnails? (default: 'yes')
    'display_thumbnail' => 'yes' | 'no'
    // Hide widget title? (default 'no')
    'widget_title_hide' => 'no'
    // Set thumbnail width (default 100)
    'thumbnail_width' => digit
    // Set thumbnail height (default 100)
    'thumbnail_height' => digit
    // Link thumbnails to post? (default: 'yes')
    'thumbnail_link' => yes' | 'no'
    // Set thumbnail rotation mode (default 'no')
    'thumbnail_rotation' => 'no|cw|ccw'
    // Set default displayed post types (default: 'post')
    'post_type' => 'post' | 'page
    // Set default displayed post status (default: 'publish')
    'post_status' => 'publish' | 'private' | 'inherit' | 'pending' | 'future' | 'draft' | 'trash'
     // Set max number of posts to display (default: 5)
    'post_limit' => digit
    // Set displayed post content type (default: 'content')
    'post_content_type' => 'content' | 'excerpt'
    // Set displayed post content length (default: 100)
    'post_content_length' => digit
    // Set displayed post content length mode (default: 'chars')
    'post_content_length_mode' => chars|words|fullcontent
    // Set displayed post title length (default 100)
    'post_title_length' => digit
    // Set displayed post title length mode (default: 'chars')
    'post_title_length_mode' => chars|words|fulltitle
    // Set post order (default: 'DESC')
    'post_order' => 'DESC' | 'ASC
    // Set post offset (default: 0)
    'post_offset' => digit
    // Set random mode (default: 'no')
    'post_random' => 'no' | 'yes'
    // Hide current post from visualization when in single post view? (default: 'yes')
    'post_current_hide' => 'yes' | 'no'
    // Set layout content mode (default: 'titleexcerpt')
    'post_content_mode' => 'titleexcerpt' | 'titleonly'
    // Display post date? (default: 'yes')
    'post_date' => 'yes' | 'no'
    // Filter posts by including post IDs (default: none)
    'post_include' => comma separated list of digits
    // Exclude posts from visualization by IDs (default: none)
    'post_exclude' => comma separated list of digits
    // Filter post by Custom Post Type (default: none)
    'custom_post_type' => comma separated list of custom post types
    // Set the default 'No posts available' text (default: 'No posts available')
    'noposts_text' => text
    // Set allowed tags to display in the excerpt visualization.
    'allowed_tags' => blankspace separated list of html tags
    // Set string break text (default: [...])
    'string_break' => text
    // Set path to optional image string break.
    'image_string_break' => text
    // Link (image)string break to post?
    'string_break_link'  => 'yes' | 'no
    // Set post date format. (default: 'F jS, Y')
    'date_format' => text
    // Filter posts by including categories IDs. (default: none)
    'category_include' => comma separated list of digits
    // When filtering by caqtegories, switch the widget title to a linked category title (default: 'no')
    'category_title' => 'no', 'yes'
    // Add the 'no-follow' attribute to all widget links.
    'nofollow_links' => 'no' | 'yes'


    i changed the post_limit and it didn’t do anything. from what i can tell, that limit is how many to show on the page. i am trying to increase the amount of posts to rotate through the spot. for example i set it to show 3 posts on the sidebar and currently it only rotate about 9 different posts through those 3 spots. i want to increase that 9 post limit to 20 or 30.

    “Set max number of posts to display” –> this displays a certain amount of actual thumbnails at once on the page.

    Plugin Author Luca Grandicelli


    There ain’t a specific limit.
    And yes, that parameter sets the amount of posts fetched from the database and to be displayed on screen.
    If you want the posts from (example) ID 10 to ID 20 to be displayed, then set the post_limit to 10, and offset by 10.



    Ok, let me present this in a different way.

    Let’s say I have 50 posts and i offset the plugin with 10, it is still only currently showing ID 10 to ID 20. i changed the above “post_limit” within the “srp-config.php” to 40 and it did nothing. based on your explanation it should show ID 10 – ID 50, correct?

    there is no setting within the widget to define how many posts to pull from, only how many to show at one time on the page.

    am i missing where this should be changed in the config files?

    within the “srp-config.php” it specifically says the following:

    | ****************************************************

    Plugin Author Luca Grandicelli


    You don’t have to touch the srp-config.php at all as explicitly written.
    Are you using a widget instance or a shortcode?

    If your case is the latter, please write here your code.
    The post_limit must be set via the widget panel or with the shortcode/php options.



    i’m using the widget. the only options that pertain to this issue are the following:

    under “basic options” there is the following..

    “Max Number of Posts/Pages to Display?
    Enter the maximum number of posts/pages to display. ____”

    this is set to 3. it shows 3 thumbnails and titles on the page as it should. when i change it to 4 it shows 4.

    i have “post offset”– under “advanced posts options” set to 10 as our main front page is set to show the 10 most recent posts so we want the sidebar widget to show the posts that start after those 10…

    but the above do not affect how many posts the plugin pulls from. it only shows about 9 older posts (ID 10 – ID 19) within those 3 spots. it does not show any posts past ID 19…

    I’m using the shortcode implementation of SRP 1.9.8, and I have the same problem –

    [srp widget_title_hide=’yes’ post_random=’yes’ display_thumbnail=’no’ post_content_mode=’titleonly’ post_date=’no’]

    which in theory should default to a display of 5 posts selected at random from my entire post archive, barring the current one if in a single post view. However, yes it picks 5 posts to display, but always from what seems to be a very restricted number of more recent posts. I’ve only got around 80 odd posts, so would expect to see some of the older ones crop up in a truly random selection quite regularly, but they never do. I just seem to get the same ones from this ‘restricted’ number of posts cropping up far too regularly, even if they are listed in a random order.

    BTW I’ve tried using the widget version of SRP, but it makes no difference as the result is the same.

    I think therefore that the process of ‘randomly’ selecting posts from the database is nowhere near as random as it should be.

    I guess this is a bug that doesn’t have a solution.

    Plugin Author Luca Grandicelli


    Sorry for the late respond.
    You seem not to have quite understood how this plugin works.
    This plugin is called “RECENT” just because it pulls the recent posts.
    So if you set a random order of 5 posts, it means it will pick up randomly from the latest 5 posts.

    If you set a post offest, the same behaviour applies. But the first n posts are skipped.

    I hope it’s clear now. This is not a bug of course, it’s the way it’s supposed to be.

    Hi Luca,

    Thanks for the response. I understand the implication of ‘Recent’ in terms of usage, but your plugin doesn’t appear to work that way either. On the basis of your comment, the following shortcode usage should simply pick the most recent 5 posts (default value) and simply display them in a random order –

    [srp widget_title_hide=’yes’ post_random=’yes’ display_thumbnail=’no’ post_content_mode=’titleonly’ post_date=’no’]

    However it is clearly selecting and displaying posts from a range beyond the most recent 5 (or 6 when excluding current one in single post view), but there does appear to be a cut-off point somewhere. From my fairly limited testing, I think the limit actually kicks in at Post 15, so you are actually picking and displaying 5 at random from the first 15.

    You can see this at work on my websites homepage ( where I have a drop down list of all the posts in date order (most recent first), underneath which I then currently use SRP to display 5 with thumbnails in random order. As you’ll see, what your plugin displays doesn’t always correspond to the first 5 in the drop down list.

    yes, it is not the number of post displayed that is the issue, that works fine. if i choose “2” – two show on my page. if i choose “5” – five show on my page. what barkeyo and i are saying is that the bucket of posts the plugin pulls from is limited. it only seems to pull in from a selection of 10 posts. i have 100 posts but it ignores 90 of them and there is no obvious setting to change that. it only shows the same 10 posts when set to random.

    i’ll try to explain it in a different way…

    100 posts in the database.
    set plugin to show 5 titles and thumbnails on front page.
    offset by 5.

    so the front page will not show post ID 1-5.
    but no matter the random rotation it only shows ID 5-15.

    we are asking if it is possible to change that very limited setting. for instance if we want the front page to rotate through ID 5-50

    @gormley, you’re using an offset of 5… and you are seeing the plugin use the next 10 as its pool of posts. Interesting, 5 + 10 = 15.

    I’m guessing that if you set the offset to 10, the plugin will always display the exact same 5 (i.e. posts 11 thru 15), just in random order at evey page reload. My testing seems to indicate the pool it uses is a static 15 most recent posts, and all the offset does is effectively reduce the number of posts available to it from the pool.

    Plugin Author Luca Grandicelli


    Ok guys, i’ve done a couple of deep tests and i must admit there is a bug in the random mode.
    Total num of posts: 20
    Offset: 0
    Last posts: 5

    This displays the last 5 posts-> 20, 19, 18, 17, 16, 15
    Unfortunally, if we enable the random mode, some posts beyond the 15th comes out, and this is not what expected.
    Thank you for getting into this and helping me to discover this new bug. I’ll put a fix soon.

    Hi Luca,

    It’s a relief that you’ve found the bug, as I love the functionality of your plugin, however my own experience with it has highlighted one thing that would be really useful in random mode. If a user could actually be able to explicitly define the number of posts being used for the pool from which the selected number of displayed posts are picked.

    i.e. if I chose 5 posts to be displayed, then rather than simply displaying the next 5 posts after any offset is taken into account, it would be great if I could define that those 5 posts should be picked at random from the next x number of posts.

    Available settings would then be:
    – Max number of posts to use (-1 for all posts)
    – Offset from most recent to exclude
    – Number of posts to display

    This would mean that the list will always be fresh (rather just the same ones displayed in a random order) and helps bring attention to older posts too.

    Once last thing, and just in case you weren’t aware, the plugin CSS defined in css-front.css is also being overridden on occasion by class-main.php. I found this when trying to change the H4 setting for the /* The single post title. */ in css-front.css. I eventually found that $srp_content .= $this->srp_create_tag('h4', $ptitlelink, $ptitle_heading_atts) in class-main.php renders the css edit useless.

    Any fix for this? the plugin still limits the number of posts it pulls from to show…

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Only Limited Number Of Posts Show’ is closed to new replies.