I am trying to create the ability for the end user to add quotes (testimonials) as posts. So far, so good. I have enabled the 'quote' post-format in my theme. So the ability exists to enter said testimonials, and I have even figured out how to show some random quotes in the sidebar. The next obvious step is to have a "testimonials" page, where all of the quotes are archived, over time. It needs the ability to be a page, which means that the client can alter the text in the page, and it can be linked to, in menus and on pages. Following the opening (editable) text, would be a list of the quotes, like an archive page, except that the entire quote would be on the page. For that reason, it would at some point, have to become paged. Any ideas?
2 Answers
Because post formats are a taxonomy, WordPress handles the archive index page automatically, using the slug type
as the taxonomy, and the post format type itself as the taxonomy term; e.g:
www.example.com/type/quote
If you want to customize the appearance of this taxonomy archive index page, you would modify the appropriate taxonomy template file, as per the Template Hierarchy:
taxonomy-post_format.php
for all post format typestaxonomy-post_format-post-format-quote.php
for the quote post format type.
-
But could the page be edited through the back end? Or would the content have to be coded into the template file?– RobCommented May 29, 2013 at 2:43
-
What do you mean? Template files are not used to add/edit content; they merely define the presentation of already defined content. Commented May 29, 2013 at 11:25
-
One of the requirements that I initially stated is that the client can edit the text. Not the text of the actual quotes, but at the top of the page there needs to be a block of text ... "Here are some nice things people have said, blah, blah, blah". I could hard code that into the template, but, ideally it should be editable through the admin section. Is that possible? Is the best solution to create a page and then load it into the template using get_page_by_title?– RobCommented May 29, 2013 at 12:08
-
Personally, I would just create a Theme Option for "Quotes page description" or some such. Commented May 29, 2013 at 12:19
-
1I did it this way, since I didn't want the rest of them. add_theme_support( 'post-formats', array( 'quote') );– RobCommented May 29, 2013 at 19:43
It reads like you want a custom post type with supports only for post-formats.
$args = array(
...
'supports' => 'post-formats'
);
register_post_type('testimonials', $args);
http://codex.wordpress.org/Post_Formats#Adding_Post_Type_Support
You could create a custom archive for your post type by copying a regular archive page and naming it after your custom post type, such as archive-testimonials.php See Post Type Templates in the codex.
Edit: Chip's answer makes more sense and he clearly has more experience than I do.
-
There's no need for a custom post type here, when the core-registered post format taxonomy will suffice. Commented May 29, 2013 at 2:38