WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Request: Something to change the Post Format names (4 posts)

  1. Jaja..
    Member
    Posted 2 years ago #

    Hello smart coding people..

    Just curious..

    Would it cost much time for you guys to build a plugin or i prefer a functions.php (add_filter) hook to rename the basic Post Format names.

    Clean out of the box in WP we have 3 options to pick from.
    - Standard
    - Aside
    - Gallery

    I would like an option to rename those three options into something that fits better to the layout attached to them.
    Something like..

    - Layout wide
    - Layout small
    - Layout center

    I don care if WP prints .gallery or .aside into the source code.
    It just for a better looking admin.

    Thanks.

  2. Jaja..
    Member
    Posted 2 years ago #

    Oww BTW

    I have found this code..
    This works for only one Post Format (name change)

    But i can duplicate it to change more Post Format names.

    function rename_post_formats( $safe_text ) {
        if ( $safe_text == 'Aside' )
            return 'Tip';
        return $safe_text;
    }
    add_filter( 'esc_html', 'rename_post_formats' );
    //rename Aside in posts list table
    function 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() == "Aside" )
                        jQuery(this).text("Tip");
                });
            });
            </script>
    <?php }
    }
    add_action('admin_head', 'live_rename_formats');
  3. Post Formats aren't extendable in the same way Custom Post Types are. You're not meant to change them that way.

  4. Jaja..
    Member
    Posted 2 years ago #

    Bummer..

    Thanks for the help.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.