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.

Tagged: 

Post format not applied correctly with Jump Start 1.1.0

  • Creator
    Topic
  • #10137
    karlo
    Participant

    Seems like post format have gone wild with JumpStart 1.1.0. Wonder if anyone can reproduce.

    I use default theme for test + default a child theme, “stretched”. Sample content imported.

    Added theme support for post format, then the snippet from doc http://dev.themeblvd.com/tutorial/incorporating-post-formats/

    content-link.php can be this

    <?php
    /**
     * What ever
     */
    ?>
    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    	<br />
    	<div class="entry-content">
    		<?php the_content(); ?>
    	</div><!-- .entry-content -->
    	<div class="clear"></div>
    	<?php edit_post_link( themeblvd_get_local( 'edit_page' ), '<p class="edit-link clearfix">', '</p>' ); ?>
    </article><!-- #post-<?php the_ID(); ?> -->

    Post format does work but in my example it mess up other posts. For example in an archive view where there is a “link” post supposed to have no title – all posts loose title. Because all posts get “Template Part: content-link.php” applied. This is from a plugin adding that inline code but nm. that.

    Same result when index.php is used, like on front/home page.

    As if JumpStart cant correctly identify what is what. is_object($post) not good enough?

    Code from doc might work but is overruled by something new in 1.1.0?

    I just tried something. Deleted Jumpstart folder, uploaded 1.0.2 and all works. content-link.php applied when it should! I am suspicious towards 1.1.0 now 😉

    Front page displays set to “latest posts”
    In Jumpstart “Homepage Content” set to posts.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
    Replies
  • #10139
    karlo
    Participant

    Title of “Post format” is crap, cant you change to “Post format not applied correctly with Jump Start 1.1.0” or something more intelligent. Not better than “Help!!!”.

    #10140
    Jason Bobich
    Keymaster

    Hey Karlo,

    This article will need to be updated, definitely. There’s actually some cool stuff you can now do with post formats, that I need to document, as well.

    So, some changes happened with how the “themeblvd_template_parts” filter works. It now happens one time before the main loop. This allows for the filter to happen just one time, opposed to over and over, and before any secondary loops happen. — Example: Someone wants to apply content-grid_something_special.php, for a specific page with the Post Grid template. If they did this before, it didn’t always work because the filter was happening inside the loop.

    Anyway, so now every time a template part is pulled there is a new filter “themeblvd_template_part” (no “s”) that happens on the individual part. By separating this out into two different things, hopefully people will have more options for things they can do with this.

    So, let’s try including your post formats like this:

    /**
     * Post format template part
     */
    function my_post_format_template_part( $part, $type ) {
    	
    	global $post;
    
    	// Could do a check for the $type, too.
    	// ...
    
    	if( is_object( $post ) ) {
    		
    		$post_format = get_post_format();
    		
    		if ( $post_format ) {
    			$part = $post_format;
    		}
    		
    	}
    	
    	return $part;
    }
    add_filter( 'themeblvd_template_part', 'my_post_format_template_part', 10, 2 );

    Does that do it?

    #10142
    karlo
    Participant

    After super fast test -> problem solved 🙂

    Except my_post_format_template_part( $part, $type ) must be function my_post_format_template_part( $part, $type ) but almost copy/paste is good enough.

    #10143
    Jason Bobich
    Keymaster

    Oh, right, obviously. I just stared at what you said for a good 30 seconds, trying to figure out what you were talking about. Doh, yes, this is how a function is declared in PHP lol.

    [fixed above]

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