WordPress.org

Ready to get started?Download WordPress

Forums

Don't understand the instructions for "ost format specific" (4 posts)

  1. pdxDaniela
    Member
    Posted 4 months ago #

    I am creating a child theme base on 2014 what do they mean a "post format specific" Please?

    <?php
    			if ( have_posts() ) :
    				// Start the Loop.
    				while ( have_posts() ) : the_post();
    					/*
    					 * Include the post format-specific template for the content. If you want to
    					 * use this in a child theme, then include a file called called content-___.php
    					 * (where ___ is the post format) and that will be used instead.
    					 */
    					get_template_part( 'content', get_post_format() );
    
    				endwhile;
    				// Previous/next post navigation.
    				twentyfourteen_paging_nav();
    
    			else :
    				// If no content, include the "No posts found" template.
    				get_template_part( 'content', 'none' );
    
    			endif;
    		?>

    Thank you
    D

  2. stephencottontail
    Member
    Posted 4 months ago #

    WordPress posts can be in a number of different post formats that describe their content: image, video, gallery, etc., and depending on your theme's design, you may want video posts to look different from all the other types of posts. If you create a file called content-video.php, for example, that file will only be called to display posts in the video format, while content.php will be used to display posts in all other post formats.

  3. pdxDaniela
    Member
    Posted 4 months ago #

    Thank you Stephen. does that mean that I an also just use as is if I don't want to change it?
    thx
    D

  4. stephencottontail
    Member
    Posted 4 months ago #

    Yep. Your child theme will use content.php by default unless it finds content-video.php or whatever.

Reply

You must log in to post.

About this Topic