0

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?

1
  • Do you know any PHP? Shouldn't be hard to build a custom page template that would pull quotes at the bottom. Commented May 29, 2013 at 1:56

2 Answers 2

1

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 types
  • taxonomy-post_format-post-format-quote.php for the quote post format type.
11
  • But could the page be edited through the back end? Or would the content have to be coded into the template file?
    – Rob
    Commented 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?
    – Rob
    Commented 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
  • 1
    I did it this way, since I didn't want the rest of them. add_theme_support( 'post-formats', array( 'quote') );
    – Rob
    Commented May 29, 2013 at 19:43
1

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.

1
  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.