2
votes

I am using the 'Special Recent Posts' plug-in in WordPress. It is being used to show header images and excerpts for articles, which you then click through to the full article.

You can set parameters on that plug-in to tell how many recent articles you would like show. Basically what I want to do is show the first five articles on the main page and then have the overflow go to new pages (like an 'older posts' type thing where there would be five posts per page).

Can anyone help me get pointed in the right direction? Every time I Google this question it doesn't quite understand...Thanks.


EDIT:

I saw the first answer and while it is moving in the right direction, it doesn't automatically generate the new pages like I would like. I want to have the overflow of special recent posts generate a new 'previous' page automatically. I understand that I could manually do this but the blog I am working on will be getting updated every day so it would be very time consuming to constantly create new pages as I go along. Can somebody point me in the right direction?


EDIT: Here is the full code I have on my index.php:

<?php get_header(); ?>

<?php c2c_the_category_image($image_extensions='png gif jpg', $image_dir='/wp-content/images/', $use_name_if_no_image=true, $start_from='begin', $limit=999); ?>

<?php echo do_shortcode("[srp srp_number_post_option='34' srp_thumbnail_option='yes' srp_widget_title_hide_option='yes' srp_post_date_option='no' srp_wdg_excerpt_length='50' srp_wdg_excerpt_length_mode='fullexcerpt']"); ?>

<?php get_sidebar(); ?>

<?php get_footer(); ?>

3
I edited my answer to show an example based on your index.php code, please let me know if it works for you.Joe M.
Did you get a chance to try the updated answer?Joe M.
I am looking at it now, thanks, I'll get back to you.MillerMedia

3 Answers

3
votes

The plugin has a parameter for this, from the documentation:

//Global Post Offset (to skip an arbitrary number of posts from the beginning)
srp_post_global_offset_option => numeric

So, on the second page, to skip 5 posts and then show the next 5, you would want something like this:

[srp srp_number_post_option='5' srp_post_global_offset_option='5']

Documentation: http://wordpress.org/extend/plugins/special-recent-posts/installation/

EDIT: To answer your question about generating new pages, technically you would not. You would have one page that would show different posts, acting like it was a different page. You would probably need use a query string (URL parameter). But, you can't put direct PHP into a wordpress post, so you need to either modify a PHP file, or get a WordPress plugin like Shortcode Exec PHP, so you can take the page number parameter from the URL and put it into the shortcode for special recent posts.

Example based on your index.php code:

$offset = ($_GET['page'] * 5) - 5;
echo do_shortcode("[srp srp_number_post_option='34' srp_thumbnail_option='yes'
srp_widget_title_hide_option='yes' srp_post_date_option='no'
srp_wdg_excerpt_length='50' srp_wdg_excerpt_length_mode='fullexcerpt'
srp_post_global_offset_option='".$offset."']"); 

Make your first page use

index.php?page=1

And your "Next Page" link:

$next = $_GET['page'] + 1;
echo '<a href="index.php?page='.$next.'">Next Page</a>';
0
votes

I never worked before the special recent post plugin. So i would like to give WordPress query post solution.

First, to get recent five post in home page (index.php) use below query parameter.

$query = new WP_Query( 'posts_per_page=5');

Second, to list older post in other page use below query parameter.

$query = new WP_Query( array( 'posts_per_page' => 5, 'offset' => 5 ) );

Above query will get posts from 6 and 5 post per page.To add pagination, add paging parameter.Refer WP_Query

0
votes

Pagination is now available in the new Special Recent Posts PRO Edition version 3.0.0