This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Problem with custom post formats

  • Creator
  • #13400
    Andre Goersch

    I made a website using custom post formats, and initially it was working fine, but I’m not sure if due to an update on Jumpstart or WordPress, my custom post formats are not working properly anymore. The website is the following:

    The formats are not being displayed correctly, the wrong formats seem to be applied to many of the posts on the post list, even if they show correctly on the Single page. It seems like the format of one post is being used for following posts, but not all. Since I just used the functions within Jumpstart to define custom post formats, I don’t really know where to begin debugging this problem. I did try deactivating plugins, reverting back to a previous version of WP and of Jumpstart, all without success.

    Do you have any suggestions?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Author
  • #13410
    Jason Bobich


    Since I just used the functions within Jumpstart to define custom post formats,

    Hmm, so this is where I’m a bit confused. Jump Start doesn’t have any kind of function for registering post formats. This is something that’s built into WordPress that you designate support for.

    Or are you not talking about actual post formats? Maybe you’re referring to something else and using the term post format? Can you explain a little more about what you mean by post formats and how you’ve set these up?


    I am too lazy to find the post but once my post format went crazy as well, was because info on had become outdated, and I had to change. Then it worked.

    Chunk for post formats is something like this, here locally!

    else if ( ! is_404() )  {
    		$post_format = '';	// Determine post format where relevant
    		if ( is_object( $post ) ) { 
    			$post_format = get_post_format();
    			if ( $post_format )
    				$part = $post_format;

    Whole section starts with

    global $post;
    	if ( is_category ( 'xxxx' ) )
    		$part = 'cat-xxxx';
    	else if ( in_category ( 'xxxx' ) && is_single() )
    		$part = 'single-xxxx';

    and so it ends with post format. So not 100% the same as in docs.

    Pretty sure you said you had to update docs.

    Not sure where ! 404 comes from, debug notice fighting or another plugin causing issues, ignore…


    From Jump Start 1.1.0 changelog

    * New internal functions for working with post formats. — See */framework/includes/post-formats.php* and */framework/includes/media.php*

    Is probably it – if this is the problem 🙂

    Not mentioned here


    Aha, more changes, $part, $type If relevant, remove these posts and spell it out in plain English. Post formats should be pimped more 🙂


    Ohhh – right under the nose. Well then this is relevant. I vote update docs! Is nifty and important part of Jump Start.

    Andre Goersch

    Oh, I wasn’t aware of these changes. My current code is pretty much the same as featured on the documentation. Since I’m more a designer that writes some code than a developer, I usually stick to copy-pasting code as much as possible.

    add_theme_support( 'post-formats', 
    // Use content-{post_format}.php for listing posts
    function my_template_parts( $parts ) {
      global $post;
      // Determine post format where relevant
      $post_format = '';
      if( is_object($post) ) 
        $post_format = get_post_format();
      // Adjust template parts
      $parts['index'] = $post_format;
      $parts['list'] = $post_format;
      $parts['list_paginated'] = $post_format;
      $parts['list_slider'] = $post_format;
      $parts['single'] = $post_format;
      $parts['archive'] = $post_format;
      $parts['search_results'] = $post_format;
      return $parts;
    add_filter( 'themeblvd_template_parts', 'my_template_parts' );

    I’m reading the links you sent, and I’m not 100% positive on what I need to change. Do I just need to add , $type to the function declaration? Some of the code on those posts don’t really resemble mine so I’m not sure how I need to implement other changes.

    Thanks a lot for the help so far.


    Will be fixed and is an easy one too but wait for Jason to get out of bed. I just got nasty flash backs seeing this issue, then I post.

    Tell him to update docs when he is done 😉

    Jason Bobich

    Ok, now it makes more sense. After I saw karlo’s posts last night it dawned on me what you were probably getting at. Sorry for the confusion.

    So, I will give you both a quick idea of how this works with template parts and the filters after Jump Start 1.1.

    When the theme initially loads, there is an array that gets set that has all of the template parts. At this time a filter called themeblvd_template_parts gets applied to this entire array just this one time. Now that array of template parts is setup to get pulled from.

    This is fine for changing template parts, however this process is happening outside of the loop. So, in this case of post formats, this will no longer work because this is constantly changing within the loop as you cycle through the different posts.

    Now, with this is place, the question comes what if you want to change template parts within the loop? — So, there is another new filter called “themeblvd_template_part” — no “s” — which is applied to each individual template part at the time it is pulled.

    So, here I think would be a better way to tackle filtering a content-*.php file for each post format:

    function my_template_part( $part, $type ) {
    	global $post;
    	$types = array( 'index', 'list', 'list_paginated', 'list_slider', 'single', 'archive', 'search_results' );
    	if (  in_array(  $type, $types ) && is_object( $post )  ) {
    		$part = get_post_format();
    	return $part;
    add_filter( 'themeblvd_template_part', 'my_template_part', 10, 2 );

    Does that work now?

    Andre Goersch

    I see. So I kept the add_theme_support declaration in the beginning, and replaced the entire following function and filter for what you provided, and now it seems to be working correctly.

    Thank you so much for the assistance. As karlo pointed out, it would be great if you could update the docs with this sort of information, since it’s basically where I base all my work from.

    Jason Bobich

    Yeah the add_theme_support() part is just how you add support for post formats in WordPress, in general. So, you definitely want to keep that.

    Yeah, I’ll definitely update the article when I can. I’ve held off on it because there’s more being added for post formats into the framework.

Viewing 10 replies - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.