Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #224521

    Hi!
    I like to post my tweets as a blog post. The currently available post formats “link”, “quote” doesn’t fit.
    How can i add a new post format “tweet” to an enfold-child theme ?
    Regards,
    Fox

    • This topic was modified 10 years, 1 month ago by flinkfoxxx.
    #224776

    Hi flinkfoxxx!

    You can edit functions.php, find this code on line 443:

    add_theme_support( 'post-formats', array('link', 'quote', 'gallery','video','image','audio' ) );
    

    Replace it with:

    add_theme_support( 'post-formats', array('link', 'quote', 'gallery','video','image','audio','status' ) );
    

    We used the status post format. You can refer to this link: http://codex.wordpress.org/Post_Formats#Supported_Formats

    You can edit the status format using this on functions.php:

    add_filter( 'post-format-status', 'avia_status_content_filter', 10, 1 );
    
    if(!function_exists('avia_status_content_filter'))
    {
    	function avia_status_content_filter($current_post)
    	{
    		/* FUNCTION HERE */
    	}
    }

    Best regards,
    Ismael

    #224856

    Hi Ismael,

    thanks for your reply. With these changes i get some warnings from font-manager.class.php (622); because the icon for status is not defined.

    Is enfold supporting get_template_part( ‘content’, get_post_format() ); ?
    I think this would make some changes a lot easier.

    Kind regards,
    Fox

    #224882

    Hi!

    Insert this code into the functions.php file:

    
    add_filter('avf_default_icons','avia_add_custom_icon', 10, 1);
    function avia_add_custom_icon($icons)
    {
    $icons['status']	 = array( 'font' =>'social-fontello', 'icon' => 'ue803');
    return $icons;
    }
    

    to register a new icon. Replace the icon and font values if necessary.

    Is enfold supporting get_template_part( ‘content’, get_post_format() ); ?

    No, because Kriesi uses a filter to change the post format layout and does not load different templates. For all available filter see: wp-content/themes/enfold/includes/helper-post-format.php

    Best regards,
    Peter

    #224887

    Hi Peter,

    thanks for the fast reply and the code fragment.

    Could you please explain why enfold doesn’t support get_template_part() and instead uses filter. What is the advantage ?

    Kind Regards,
    Fox

    #225343

    Hi!

    Its just a different way of loading in the templates that allows for more code to be reused and all of the post formats to be in the single file.

    Best regards,
    Devin

    #225377

    Hi Devin,
    thank you for your answer. I think this way it is harder for your customers to adapt the theme. I would realy like to see support for get_template_part() and the post-format ‘status’ and ‘chat’. Thank you ;-)

    Best regards,
    Foxx

    #225496

    Hi!

    Please hire a freelance developer if you want to use the get_template_part() function instead of the post formats filters that are being use within the theme. Visit Werkpress for customizations.

    Cheers!
    Ismael

    #225509

    Hi Ismael,

    i am a freelance developer
    i like coding standards
    i like standard wordpress functions
    i like KISS

    *bigsmile* ;-)

    Kind regards,
    Foxx

    #225784

    Just for anyone visiting this later on and for clarity the theme uses get_template_part for grabbing code when needed. For the post formats its just easier and Keeps It Simple by having them all in one file where they can be edited quickly and easily. Instead of having half a dozen files with repeating code Kriesi is able to reuse much larger portions of code and functions while keeping post formats intact.

    There will be no point where it will change to use content-$posttype for Enfold but if you want to change it you definitely could.

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