Actually, as soon as I posted that, I found a piece of code online that almost does what I want. Here it is: http://seedprod.com/wordpress-the-loop-shortcode/
That adds a shortcode called "loop". I create a page called "Visitor Submissions" and used the shortcode as my Page content:
[loop category="stories" pagination="false"]
That's the only thing I entered in my Page. I have pagination set to false there so all the posts in the "stories" category will be on one page.
However, this shortcode too defaults to displaying only a list of post titles, linked. That happens on this line:
<li><a href="" rel="bookmark"></li>
Since I am using the default Twenty Eleven theme (a child theme of it anyway), I changed that one line to this:
<?php get_template_part( 'content', get_post_format() ); ?>
That one line change created the output you see here:
http://gravity.chrishajer.com/visitor-submissions/
There are a lot of things wrong with the format of that page, but I was not going to spend time fixing them. What you would do is copy the loop code from your archive.php or index.php template and replace that one line with your code. That will essentially loop through all the posts in your one category, and display them just as they're displayed on your archive or index page.
There might be other things to be changed (body class due to this being a Page vs a Post for example) but it is certainly possible to do what you want by using this code in your functions.php or creating a mini-plugin out of it. It will just need to be tweaked for your use to match your existing template.
Posted 13 years ago on Friday July 29, 2011 |
Permalink