• Hello I have made a widget of my own using part of the blog php code and I want to be able to restrict how much of the_content is displayed E.G. – First 20 words

    Is this possible

    Please let me know

    Code I am using is below

    <?php
    $temp = $wp_query;
    $wp_query= null;
    $wp_query = new WP_Query();
    $wp_query->query(‘showposts=5′.’&paged=’.$paged);
    if ($wp_query->have_posts()) : while ($wp_query->have_posts()) : $wp_query->the_post();
    global $more; $more = 0;
    ?>
    <div id=”post_space”>
    </div>

    <div class=”post_title”>
    ” rel=”bookmark” title=”<?php the_title(); ?>”><?php the_title(); ?>
    </div>

    <div class=”post_date”>
    <?php the_time( get_option( ‘date_format’ ) ); ?>
    </div>

    <?php the_content(__(‘Read more’));?><div style=”clear:both;”></div>
    <?php endwhile; else: ?>

    <p><?php _e(‘Sorry, no posts matched your criteria.’); ?></p><?php endif; ?>
    <p><?php posts_nav_link(‘ — ‘, __(‘« Previous Page’), __(‘Next Page »’)); ?></p>
    <?php $wp_query = null; $wp_query = $temp; ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • Try an auto excerpt plugin first. For example: http://wordpress.org/extend/plugins/auto-excerpt/. Or, if you don’t like how they break the content, you can look into the code on how they break the content, so that you can implement your own logic to break the content.

    Thread Starter justin105

    (@justin105)

    Agus Suhanto

    I have figured it out now thank you.

    I now need to make a plugin for the code i have got and incorporate it into a package which is going ot be fun

    Got no idea how to do it but may well give it a a shot

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

The topic ‘Post Content Recent Posts’ is closed to new replies.