Implementing post-Format
-
Hope someone can help me. I am trying to implement post-format in the theme I am developing but having problems getting the
formats to display. After reading all the articles I could find and the codex, I came up with the following code in the index.php
I also add the code for theme support in function.php.Whenever I apply the format to a post from the admin it does not display the format. It looks like it’s all falling back to
content.php. Not really sure what I am doing wrong or missing out. This is my first attempt developing a theme from scratch,
I know I have alot to learn along the way. Any help will be greatly appreciated.I have my template files as:
content.php
content-aside.php
content-quote.phpPost format in function.php
===============================add_theme_support( 'post-formats', array( 'aside', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video', 'audio' ) );?>Code from index.php
==========================<?php while ( have_posts() ) : the_post(); ?> <!-- get template part for post format --> <?php if (has_post_format('standard')) { get_template_part('content'); } elseif (has_post_format('aside')) { $format = get_post_format('aside'); get_template_part('content', $format); } elseif (has_post_format('quote')) { $format = get_post_format('quote'); get_template_part('content', $format); } else{ get_template_part('content'); } ?> <?php endwhile; ?>
The topic ‘Implementing post-Format’ is closed to new replies.