• Resolved touto

    (@touto)


    Hi,

    I want to adapt the existing WordPress post formats for my theme (standard, aside, link, etc.). I have already adapted the standard and aside types successfully (some time ago).

    However, when I try to adapt a new format (e.g. link), the changes I make in content-link.php are not visible in the post. Even though I selected “Link” as the post format in the admin dashboard, it is displaying the post as a standard post. I know that because when I make changes in content-single.php (for the standard posts), it is visible in the post that is supposed to have a link format.

    What could be wrong here?

    My functions.php

    
    add_theme_support( 'post-formats', array( 'aside', 'link', 'quote', 'standard' ) );
    
    add_action( 'after_setup_theme', 'childtheme_formats', 11 );
      function childtheme_formats(){
        add_theme_support( 'post-formats', array( 'aside', 'link', 'quote' ) );
      }
    

    The only two formats where my changes in the php files have an effect, are for standard and aside.

    // EDIT

    I can answer my own question: I forgot to adjust single.php in my childtheme, where I have the following now in order to add the link format (I can edit content-link.php now):

    <?php
    /**
     * The single post.<br>
     * This file works as display full post content page and its comments.
     *
     * @package bootstrap-basic4
     */
    
     if ( get_post_format( get_the_ID() ) == 'aside'  ) {
        get_template_part( 'content', 'aside');
     } 
     elseif ( get_post_format( get_the_ID() ) == 'link'  ) {
        get_template_part( 'content', 'link');
     } 
     else {
        get_template_part( 'content', 'single');
     }
    // begins template. -------------------------------------------------------------------------
    
    ?>
    
    • This topic was modified 4 years ago by touto.
  • The topic ‘Changes to post format templates not visible’ is closed to new replies.