0

I want to use post formats but the theme (WP-Bootstrap by 320Press) on which my current template is based doesn't make use of the content.php template, only single.php.

Is it possible to edit the template hierarchy so that you can append formats to the single template (single-image.php, for example)? Alternatively, if this is best avoided, can anyone suggest another workaround?

  • Take a look here - Template Hierarchy. It will hopefully give you an insight in to how WP determains which template to use. Any way, while questions relating to themes are technically off-topic here, usually people will try to help if they can. The problem is though, you've not posted the code for single.php, so it's impossible to help. – David Gard Feb 19 '15 at 16:43
0

It is easy to make this work if your theme don't support post formats

  • Create a child theme

  • add_theme_support for post formats

  • Remove the loop from your template files and add replace it with get_template_part( 'content', get_post_format() );. Your template should look like this

    if ( have_posts() ) { // <- Not necessary in single.php
    
        while ( have_posts() ) {
            the_post();
    
            get_template_part( 'content', get_post_format() );
    
        }
    
    }
    
  • Everything else should go into a new file which should be called content.php

  • Create a new file called content-image.php and add the loop in there and modify as needed

  • When a post is assigned the image post format, content-image.php will be used inside single.php to display the image posts

Look at one of the bundled themes how to exactly make use of post formats

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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