Support » Plugins and Hacks » Hacks » Problem with custom post types and loops

  • Hello guys!

    I’m using wordpress latest, 3.1.3 version.
    With wordpress More Types plugin I’ve created Events post type.

    I added some basic information about event such as title and short description.

    Then in my sidebar.php I included upcoming-events.php file like this
    <?php get_template_part('upcoming', 'events'); ?>
    and in that file I have this code:

    <?php $events = new WP_Query( 'post_type=event&showposts=5' ); ?>
    <div class="widget widget_upcoming_events" id="upcoming_events">
        <h2>Upcoming Events</h2>
        <?php if( $events->have_posts()) :  while( $events->have_posts() ) : $events->the_post(); ?>
    		<h3><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
            <?php the_content('Read More →'); ?>
        <?php endwhile; ?>
        <?php else: ?>
        No Upcoming Events
        <?php endif; ?>
    </div>

    On home page it shows me just like I want it. In Editor where I “split” the event description, the “Read More” tag appears there.

    Take a Look at this screenshot – http://img18.imageshack.us/img18/6321/screen1fp.png

    But when I go to other pages, such as Archive, Category, Single and etc, the “more tag” in upcoming events doesn’t work. It gives me full text, instead of teaser. Look at this screenshot – http://img9.imageshack.us/img9/5061/screen2byj.png

    So, can anyone help me to solve this problem? All I want to do, is that “more tag” work on every page normally. : )

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Problem with custom post types and loops’ is closed to new replies.