Forums

Latest News a short description (1 post)

  1. CreativeWP
    Member
    Posted 4 years ago #

    Hello, every one, I am working on this project, and I was asked to add in the latest post "Feature News" a brief short of the recent article published in the WP website. Before the whole article would show up, but now I figured out how to give only a short version of it. But never the less is too little, I would like see close to 200 words before the article cuts, then tells you to go to the next page. But I do not know how to. Probably there is an easy way, I tried the exerpt, but still is too little.

    I am pretty sure that there is a way to have it automatically done, like: http://www.eventindustrynews.co.uk/ the section called "Feature News"

    See code:

    <?php get_header(); ?>
    	<!-- BEGIN content -->
    	<div id="content">
    
    		<?php if (have_posts()) : the_post(); ?>
    		<!-- begin latest -->
    		<div class="latest">
    		<a href="<?php the_permalink(); ?>"><?php dp_attachment_image(0, 'thumbnail', 'alt="Latest News"'); ?></a>
    		<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    		<div class="noimage"><?php the_content('Read More'); ?></div>
    		<?php ob_start(); the_excerpt(); echo dp_clean(ob_get_clean(), 550); ?>...
    
    		<a class="readmore" href="<?php the_permalink(); ?>">Read full story &raquo;</a>
    		<div class="break"></div></div>
    		<!-- end latest -->
    		<?php endif; ?>
    
    		<?php
    		if (have_posts()) : $side = 'r';
    		while (have_posts()) : the_post();
    		$arc_year = get_the_time('Y');
    		$arc_month = get_the_time('m');
    		$arc_day = get_the_time('d');
    		$side = ($side=='r') ? 'l' : 'r';
    		?>
    
    		<div class="<?php echo $side; ?>">
    			<!-- begin post -->
    			<div class="post">
    			<h2><?php the_category(', '); ?></h2>
    			<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
    			<?php dp_attachment_image(0, 'thumbnail', 'alt="' . $post->post_title . '"'); ?>
    			<?php ob_start(); the_excerpt(); echo dp_clean(ob_get_clean(), 350); ?>...
    
    			<div class="break"></div>
    
    <a class="readmore" href="<?php the_permalink(); ?>">Read full story &raquo;</a>
    
    			</div>
    			<!-- end post -->
    		</div>
    		<?php endwhile; ?>
    		<div class="break"></div>
    		<!-- begin post navigation -->
    		<div class="postnav">
    		<?php if(function_exists('wp_page_numbers')) { wp_page_numbers(); } ?>
    		</div>
    		<!-- end post navigation -->
    		<?php else : ?>
    		<div class="notfound">
    			<h2>Not Found</h2>
    			Sorry, but you are looking for something that is not here.
    
    		</div>
    		<?php endif; ?>
    
    	</div>
    	<!-- END content -->
    <?php get_sidebar(); get_footer(); ?>

    The code piece I added was

    <?php ob_start(); the_excerpt(); echo dp_clean(ob_get_clean(), 350); ?>...

    Please help me.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags