WordPress.org

Ready to get started?Download WordPress

Forums

Insert automatic line between blog entries (2 posts)

  1. jennaburpee
    Member
    Posted 4 months ago #

    Hi!

    I am trying to find the easiest way to insert a thin line between blog posts so it automatically separates each post on my main page: http://www.jennaburpee.com

    I've read a few older reviews, but I am very new to web design so will need in depth instructions on where/how to edit the css sheet if that's what I will need to do! I am currently using the 2013 WP Theme.

    Thanks in advance!

    The blog I need help with is http://www.jennaburpee.com.

  2. Gemfruit
    Member
    Posted 4 months ago #

    You should have something very close to this in your index.php file.

    <?php if (have_posts()) : ?>
    						<?php while (have_posts()) : the_post(); ?>
    
    						<div <?php post_class("home-page-post") ?> id="post-<?php the_ID(); ?>">
                                <?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) { the_post_thumbnail(array(260,200), array("class" => "alignleft post_thumbnail")); } ?>
    							<h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    
    							<div class="entry">
    								<?php echo(get_post_meta($post->ID, '_yoast_wpseo_metadesc', true)); ?>
    							</div>
    						</div><!--/post-<?php the_ID(); ?>-->
    
    				<?php endwhile; ?>
    
    				<?php else : ?>
    					<h2 class="center">Not Found</h2>
    					<p class="center">Sorry, but you are looking for something that isn't here.</p>
    					<?php get_search_form(); ?>
    
    				<?php endif; ?>

    You'll want to add the css to create the line to your style.css, then add that class to the above code, right after this:

    <div class="entry">
    								<?php echo(get_post_meta($post->ID, '_yoast_wpseo_metadesc', true)); ?>
    							</div>
    						</div><!--/post-<?php the_ID(); ?>-->

    Essentially, that's the loop that is going to find all of your posts to display, then display them. At the end of the loop, you add the line, which will put the line between each post.

Reply

You must log in to post.

About this Topic

Tags

No tags yet.