Jump to content
Sign in to follow this  
buddhistwhatson

wordpress 3.1 and post formats

Recommended Posts

buddhistwhatson

hello; i want to use the new posts format feature in wp 3.1 i have read this help file http://wordcastnet.com/2011/wordpress-post-formats-tutorial-add-tumblr-style-features-to-your-blog-with-wordpress-3-1/ but i know with pp, i should use child themes and i read about hooks although i dont know what they are. Can you please help me. with what is should do with the code in the example ------------------------------------------------ Adding Post Formats to a WordPress Theme In order to use post formats on your WordPress blog, you must add the theme support in your WordPress Theme??™s functions.php template file using the following code: add_theme_support( 'post-formats', array( 'aside', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video', 'audio' ) ); This line of code will enable all possible post formats, though you only need to include those you require, or expect to use. Once added, the ???Formats??? box will become available in the WordPress Post editor. If you are using a Child Theme, add the code to the child theme after the after_setup_theme set of functions in functions.php. Currently, if you add it to the Parent Theme, it will not appear when the Child Theme is activated. Changing Post Display Based on Format In The Loop of a WordPress Theme??™s code, which displays posts, we can use the conditional tag has_post_format() to add and remove HTML and PHP template code based on the selected post format. As an example, let??™s say we want to display a special icon for video posts: ? 1 2 3 <?php if(has_post_format('video')) { ?> Alternate Tags are Important <?php } ?> As another example, to not display the post title for asides: ? 1 2 3 <?php if(!has_post_format('aside')) { ?> <h2><?php the_title(); ?></h2> <?php } ?> REMINDER: These examples are modifications to make to your existing loop structure, not simply things to copy in. If you simply add the second example instead of changing with your existing title format, you??™ll end up with two titles! =------------------------ can you please tell me what code to put where in which files? Thank you

Share this post


Link to post
Share on other sites
bryan-hadaway

Let me get a developer to look at this. Thanks, Bryan

Share this post


Link to post
Share on other sites
buddhistwhatson

thank you

Share this post


Link to post
Share on other sites
galsterer

I am also very interested in the Tumblr Style. Are you planning to integrate this into platformpro?

Share this post


Link to post
Share on other sites
cmunns

You would want to use PlatformBase: 1. add the theme_support function to the functions.php inside of PlatformBase. Add somewhere after this line: `require_once(TEMPLATEPATH . "/core/core.init.php");` 2. copy template.postloop.php from the parent theme to the child theme and modify it per the instructions provided. It will probably be a lot of trial and error, but this is exactly how you improve your WP skills.

Share this post


Link to post
Share on other sites
Simon

Or alternatively... 3.1 post-formats actually do not require ANY extra code, they can be used purely with css! For example: add this to your child functions.php `add_theme_support( 'post-formats', array( 'aside' ) );` This enables the aside format, so you can now make an aside post in the post editor. Now when the new aside post is displayed, it has a new class, `format-aside` so you can style it however you want, without editing any core templates!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×