on this page, it's a regular wordpress page (not archive.php or category.php or anything like that). in the page, I have the following php code which should pull in the 15 most recent posts, plus, it should an "Older Entries" link at the bottom to early entries. <?php $custom_query = new WP_Query( 'posts_per_page=15&cat=1' ); if ( $custom_query->have_posts() ) : while ( $custom_query->have_posts() ) : $custom_query->the_post(); ?> <h3><?php the_title(); ?></h3> <h6><?php the_time('F j, Y') ?></h6> <?php the_content(); ?> <hr class="homenews" /> <?php previous_posts_link('« Older Entries', 5) ?> <?php endwhile; else : ?> <h3>Sorry...</h3> <p>No posts were found.</p> <?php endif; ?> PHP: but for some reason the "Older Entries" link is not appearing. how come? please advise. thanks in advance!
It is due to the error in the query code. You have used old format, you need to use the new format. Here is the solution: http://www.thepesta.com/wordpress/wp-pagination-error-with-query_post.html
well i replaced what i had before with the code below (based on that solution), but the Pagination still does not appear after the 15th post. <?php query_posts( array( 'posts_per_page' => 15, 'cat' => '1', /* change CategoryID with exact value */ 'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1 ), )); ?> PHP: how come the pagination isn't appearing? also, i'd like to have the published date appear right below the title of each post. how do i do that? please advise. thanks!
It should have worked. Update your permalink structure. If your files are not writable, then update your .htaccess manually. And then try again. If problem not solved after this, then add following code instead of your current code: <?php $paged = (get_query_var('paged')) ? get_query_var('paged') :1; query_posts( array ( 'posts_per_page' => 15, 'cat' => '1', 'paged' => $paged, )); ?> PHP: To show post published date. put this code where you want to show it: <?php get_the_date(); ?> PHP:
so how do it put it all together? like this? <?php $paged = (get_query_var('paged')) ? get_query_var('paged') :1; query_posts( array ( 'posts_per_page' => 15, 'cat' => '1', 'paged' => $paged, )); <?php get_the_date(); ?> <?php previous_posts_link('« Older Entries', 5) ?> ?> PHP: php is clearly not my strong suite...
Adding pagination code after query post will not solve it. And also there is error in your code. If you are interested, then you can give me your wp-admin, and I can look for it. Your code shoud be: <?php $paged = (get_query_var('paged')) ? get_query_var('paged') :1; query_posts( array ( 'posts_per_page' => 15, 'cat' => '1', 'paged' => $paged, )); get_the_date(); previous_posts_link('« Older Entries', 5); ?> PHP: But it will not work.
you mean it will not work until the error that you see is cleaned up? i'd rather not provide wp-admin credentials. i'd prefer to just paste in a section of code where you believe the error resides. what file's code would you like to see? i appreciate you bearing with me here...
Ok no problem. You have said that, it is not working on your /store-news/ page. Did you created any custom page template for that? Or using that page as your blog page? If that is your blog page, then give me index.php (or home.php if any). If using custom page, give me code of that page.
it's not a custom page template. it's just a regular, run of the mill page that i stuck this code in to create a blog-style page for just this topic of posts. i'm using the PHP Execution plugin to allow for php in a regular page: http://www.zehnet.de/2009/02/25/wordpress-php-execution-plugin/. please advise.
Without seeing your template structure, I can not help much. Paste the codes you are using for the custom query. Are you using them directly in the page using PHP Exec?
it's just a standard run of the mill wordpress page. and in the HTML tab of that page's editor, i place the code that you instructed me to. <?php $paged = (get_query_var('paged')) ? get_query_var('paged') :1; query_posts( array ( 'posts_per_page' => 15, 'cat' => '1', 'paged' => $paged, )); get_the_date(); previous_posts_link('« Older Entries', 5); ?> PHP: you can see the results on this test page. but still there's no Older Entries link at the bottom. Nor do the post dates appear below the post titles. what am i missing?
As you are using those codes from PHP Exec, they are actually being placed on page.php Using custom page template will be the best solution. It's tough to give solution from this situation. You can either give me access, so I can check, or you can send me all theme files to look for it. Solution will be either custom page template or using a is_page condition in home.php, that is also similar to custom page.
i prefer not to grant access but which file codes would you like to see? one of the files from the PHP Exec plugin that I'm using?
Let's try another approach. I setup another site with the same functionality. This other site just uses the basic TwentyTen theme. No customization. This page of the new site is using the code below (a replica of what's on the other site), yet the "Older Entries" link still does NOT appear at the bottom of the page. Nor does the Date appear right below the post title. <?php $paged = (get_query_var('paged')) ? get_query_var('paged') :1; query_posts( array ( 'posts_per_page' => 3, 'cat' => '3', 'paged' => $paged, )); get_the_date(); previous_posts_link('« Older Entries', 5); ?> PHP: I just PM'd you the access user login I created for you. Please advise. thanks!
ok, i uploaded that page to the twentyten folder. however when i go to that page editor, i don't see this new option in the "Template" dropdown. shouldnt it appear there? what am i missing?
You did not miss anything. That is actually a page, not a full template. So it will be under twenty ten theme. Check the image. Check this page: http://greenrefurbishing.com/wordpress/?page_id=8 I have set category 3 with 3 posts per page.
i'm really confused as to how ?page_id=8 connects to this page-test-page.php file? when i'm in the editor for page 8, there's nothing to select that says "hey, use the page-test-page.php template". please advise. thanks for bearing with me.