• Hi,

    I’m working on a blog.

    http://artnouveaumagazine.com/blog8/

    I want to do two things. Above each post it repeats the “Latest Posts” tag. I want it only above the first one so I want to delete the others.

    Also,

    I want to add some line or something inbetween each post to break up the content a bit.

    Any help with this is appreciated.

Viewing 7 replies - 1 through 7 (of 7 total)
  • the easy bit first – separation between posts:
    in the style.css find the line with #latest_post and change it into:

    #latest_post { padding: 0 0 1.5em 0;
    border-bottom: 2px dotted #aaa;
    margin-bottom:10px; }

    about border.

    to get ‘latest post’ only once, you need to edit index.php – best post it here to get detailed help.

    Thread Starter kdaye87

    (@kdaye87)

    Thank You! And here is the code for index.php

    <?php get_header(); ?>        
    
            <div id="topbanner" class="column span-14">   <!-- start top banner -->
                <div class="pagetitle">
                    // index
                </div>
            </div>   <!-- end top banner -->
    
            <div id="arch_content" class="column span-14">   <!-- start home_content -->
    
            <?php if (have_posts()) : ?>
    
            	<div class="column span-3 first">
                	<h2 class="archive_name"><?php bloginfo('name'); ?></h2>        
    
                	<div class="archive_meta">
    
                		<div class="archive_feed">
                			<a href="<?php bloginfo('rss2_url'); ?>">RSS feed for <?php bloginfo('name'); ?></a>
                		</div>
    
                	</div>
                </div>
    
                <div class="column span-8">
    
                <?php while (have_posts()) : the_post(); ?>
    
                	<div class="archive_post_block">
                		<h3 class="archive_title" id="post-<?php the_ID(); ?>"><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    
                		<div class="archive_post_meta">By <?php the_author_posts_link(); ?> <span class="dot">&sdot;</span> <?php the_time('F j, Y'); ?> <span class="dot">&sdot;</span> <a href="<?php comments_link(); ?>"><?php comments_number('Post a comment','One comment','% comments'); ?></a></div>
    
                		<?php the_excerpt(); ?>
                	</div>
    
                	<?php endwhile; ?>
    
    				<div class="navigation">
    					<p><?php next_posts_link('&laquo; Previous') ?> &nbsp; <?php previous_posts_link('Next &raquo;') ?></p>
    				</div>
    
    				<?php else : ?>
    
    					<p>Lost? Go back to the <a href="<?php echo get_option('home'); ?>/">home page</a>.</p>
    
    				<?php endif; ?>
    
                </div>
    
                <?php get_sidebar(); ?>
    
            </div>   <!-- start home_content -->
    
    <?php get_footer(); ?>
    Thread Starter kdaye87

    (@kdaye87)

    also by background I mean making the background look like hypebeast.com could i use bg image in css to that? I’ve tried but have styled it incorrectly i guess.

    I don’t actually see a bg image on hypebeast…..to which image are you referring?

    (are you sure the code you posted is from index.php?….it doesn’t look like it is…..it has alink back to the homepage….which would be strange for index as that is your homepage usually? Unless you have a custom setup going)

    Something’s going wrong anyway. In the source code of http://artnouveaumagazine.com/blog8/ I see multiple divs with id="latest_post".

    Thread Starter kdaye87

    (@kdaye87)

    I see them too. And yes, that’s the index.php

    This is what’s in home.php

    <?php get_header(); ?>
    
    		<div id="topbanner" class="column span-14">   <!-- start top banner -->
                <div class="pagetitle">
                    // home
                </div>
            </div>   <!-- end top banner --> 
    
            <div id="home_content" class="column span-14">   <!-- start home_content -->
    
                <div id="home_left" class="column span-7 first">   <!-- start home_left -->
    
                	<?php $catid = $wpdb->get_var("SELECT term_ID FROM $wpdb->terms WHERE name='Asides'"); ?>
    
    				<?php $catid2 = $wpdb->get_var("SELECT term_ID FROM $wpdb->terms WHERE name='Featured'"); ?>
    
    				<?php $the_query = new WP_Query('cat=-' .$catid. '&showposts=4&orderby=post_date&order=desc');
    
    				while ($the_query->have_posts()) : $the_query->the_post();
    
    				$do_not_duplicate = $post->ID; ?>
            <h3 class="mast">Latest Posts</h3>
    				<div id="latest_post">   <!-- start latest_post -->
    
    					<?php if ( get_post_meta($post->ID, 'latest_home_img', true) ) { ?>
    
    					<div id="latest_post_image">
    					<a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/latest/<?php echo get_post_meta($post->ID, "latest_home_img", $single = true); ?>" alt="<?php bloginfo('name'); ?>: Latest post" width="470" height="175" /></a>
    					</div>
    
    					<?php } ?>
    
    					<h3 class="latest_post_title" id="post-<?php the_ID(); ?>"><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    
    					<p><?php echo strip_tags(get_the_excerpt(), '<a><strong>'); ?></p>
    
    					<div class="latest_post_meta">
    						<span class="latest_read_on"><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">Continue Reading</a></span>
    						<span class="latest_comments"><?php comments_popup_link('Post a comment', 'One comment', '% comments', '', 'Comments off'); ?></span>
    						<?php $cat = get_the_category(); $cat = $cat[0]; ?>
    						<span class="latest_category"><a href="<?php echo get_category_link($cat->cat_ID);?>"><?php echo $cat->cat_name; ?></a></span>
    					</div>
    				</div>   <!-- end latest_post -->
    
    				<?php endwhile; ?>
    
                </div>   <!-- end home_left -->
    
                <div id="home_right" class="column span-7 last">
    
                	<div id="home_about">
    
    					<h3 class="mast3">Welcome to <?php bloginfo('name'); ?></h3>
    
    					<?php $the_query = new WP_Query('pagename=description');
    
    					while ($the_query->have_posts()) : $the_query->the_post();
    
    					$do_not_duplicate = $post->ID; ?>
    
    					<?php the_content(); ?>
    
    					<?php endwhile; ?>				
    
    				</div>
    
    				<div class="column span-4 first">
    
    					<h3 class="mast">Recent Posts</h3>
    
    					<?php $the_query = new WP_Query('cat=-' .$catid. '&showposts=5&offset=1&orderby=post_date&order=desc');
    
    					while ($the_query->have_posts()) : $the_query->the_post();
    
    					$do_not_duplicate = $post->ID; ?>
    
    					<div class="home_recent_post">
    
    						<?php if ( get_post_meta($post->ID, 'thumb_home_img', true) ) { ?>
    						<div class="home_recent_thumb">
    							<a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/thumbs/<?php echo get_post_meta($post->ID, "thumb_home_img", $single = true); ?>" alt="<?php the_title(); ?>" /></a>
    						</div>
    						<?php } else { ?>
    						<div class="home_recent_thumb">
    							<a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php
    							the_title(); ?>"><?php if (function_exists('the_thumb')) { the_thumb('altappend=recent_&subfolder=recent&width=48&height=48&keepratio=0'); } ?></a>
    						</div>
    						<?php } ?>
    
    						<div class="home_recent_title" id="post-<?php the_ID(); ?>">
    							<a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a>
    						</div>
    
    						<div class="home_recent_date">
    							<?php the_time('F j, Y'); ?>
    						</div>
    
    						<div class="home_recent_auth">
    							By <?php the_author(); ?>
    						</div>
    
    					</div>
    
    					<?php endwhile; ?>
    
    					<?php include('ad_home.php'); ?>
    
    					<?php if ( !function_exists('dynamic_sidebar')
    					        || !dynamic_sidebar('MiddleColumn') ) : ?>
    
    					<div id="side_tag_cloud">
    
    						<h3 class="mast">Browse</h3>
    
    						<?php wp_tag_cloud(''); ?>
    
                		</div>					
    
    					<?php endif; ?>
    
                	</div>
    
                    <?php get_sidebar(); ?>         
    
                </div>
    
            </div>   <!-- end home_content -->        
    
    <?php get_footer(); ?>

    in home.php:
    add
    <?php $marker=0; ?>
    and change the line with ‘Latest Post’ into a conditional statement:

    <?php if($marker==0) { $marker=1; ?> <h3 class="mast">Latest Posts</h3> <?php ; } ?>

    so that the area in home.php should look like:

    <?php get_header(); ?>
    
    		<div id="topbanner" class="column span-14">   <!-- start top banner -->
                <div class="pagetitle">
                    // home
                </div>
            </div>   <!-- end top banner -->
    <?php $marker=0; ?>
            <div id="home_content" class="column span-14">   <!-- start home_content -->
    
                <div id="home_left" class="column span-7 first">   <!-- start home_left -->
    
                	<?php $catid = $wpdb->get_var("SELECT term_ID FROM $wpdb->terms WHERE name='Asides'"); ?>
    
    				<?php $catid2 = $wpdb->get_var("SELECT term_ID FROM $wpdb->terms WHERE name='Featured'"); ?>
    
    				<?php $the_query = new WP_Query('cat=-' .$catid. '&showposts=4&orderby=post_date&order=desc');
    
    				while ($the_query->have_posts()) : $the_query->the_post();
    
    				$do_not_duplicate = $post->ID; ?>
     <?php if($marker==0) { $marker=1; ?> <h3 class="mast">Latest Posts</h3> <?php ; } ?>
    				<div id="latest_post">   <!-- start latest_post -->

    not tested, but the usual way to show something only the first time in the loop.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Adding Lines Between Posts’ is closed to new replies.