Support » Theme: Leaf » add post format

  • Resolved nyan-nyan

    (@nyan-nyan)


    Hi everyone!

    How to add post format?

    I tried add ‘test’ in theme-functions.php line 42 add_theme_support().
    but not add.

    Please tell me how.

Viewing 4 replies - 1 through 4 (of 4 total)
  • add_theme_support( 'post-formats', array( 'aside', 'gallery' ) );
    would certainly work.

    http://codex.wordpress.org/Post_Formats

    Thanks Sayed!

    I want to use the original format.
    For example ‘spring’ ‘summer’…

    so added
    add_theme_support( ‘post-formats’, array( ‘aside’, ‘gallery’, ‘spring’, ‘summer’ ) );

    and

    I was up content-spring.php content-summer.php file to a server.

    but not showing ‘spring’ ‘summer’ format list in new post page.

    I think different names are not supported however you can do it like this.

    add_filter( 'esc_html', 'comi_rename_post_formats' );
    function comi_rename_post_formats( $safe_text ) {
        if ( $safe_text == 'Quote' )
            return 'Game';
        elseif ( $safe_text == 'Link' )
            return 'Story';
        elseif ( $safe_text == 'Image' )
            return 'Edge Article';
    
        return $safe_text;
    }
    
    //rename Aside in posts list table
    
    add_action('admin_head', 'comi_live_rename_formats');
    function comi_live_rename_formats() {
        global $current_screen;
    
        if ( $current_screen->id == 'edit-post' ) { ?>
            <script type="text/javascript">
            jQuery('document').ready(function() {
    
                jQuery("span.post-state-format").each(function() {
                    if ( jQuery(this).text() == "Quote" )
                        jQuery(this).text("Game");
                    else if( jQuery(this).text() == "Link" )
                        jQuery(this).text("Story");
                    else if( jQuery(this).text() == "Image" )
                        jQuery(this).text("Edge Article");
                });
    
            });
            </script>
    <?php }
    }

    Hi Sayed!

    Oh…different names are not supported…

    but the code which you taught to me is wonderful.

    Thank you Sayed!!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘add post format’ is closed to new replies.