• First of all, sorry that I’m posting too much silly questions on this forum, cuz I’m new to wordpress, and trying to customize my site as much as I could. Okay so today I found about post formats (video, link and all)

    I want to add following loop element (or whatever it really is) to my single.php:

    <?php elseif ( ( function_exists( 'get_post_format' ) && 'link' == get_post_format( $post->ID ) )  ) : ?>  
    
            <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
                <h2 class="entry-title"><a href="<?php echo get_the_content(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
            </div>

    Here is my single.php file, tell me where to add above code:

    <?php get_header(); ?>
    
    <div id="content" >
    
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    
    <div class="post" id="post-<?php the_ID(); ?>">
    
    	<div class="title">
    		<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
    	</div>
    
    	<div class="postmeta">
    		<span class="pmet">Posted by <?php the_author_posts_link(); ?>  on <?php the_time('M - j - Y'); ?> </span>
    	</div>
    	<div class="entry">
    		<?php the_content('Read the rest of this entry &raquo;'); ?>
    		<div class="clear"></div>
    		<div class="pagelink"><?php wp_link_pages(); ?></div>
    	</div>
    
    	<div class="titlemeta clearfix">
    		<span class="categori"> Categories: <?php the_category(', '); ?>   </span>
    	</div>
    
    <nav id="nav-single">
                            <span class="nav-previous"><?php previous_post_link( '%link', __( '<span class="meta-nav">←</span> Previous', 'twentyeleven' ) ); ?></span>
                            <span class="nav-next"><?php next_post_link( '%link', __( 'Next <span class="meta-nav">→</span>', 'twentyeleven' ) ); ?></span>
                        </nav><!-- #nav-single -->
    
    </div>
    
    <?php comments_template(); ?>
    <?php endwhile; endif; ?>
    
    </div>
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    Thanks!

  • The topic ‘Adding Loop To single.php’ is closed to new replies.