Support » Fixing WordPress » How to Make Post Formats Display in Sidebar

  • I use aside posts on my site to create the category “weekly challenge.” I did some hacking to allow aside posts to have an excerpt, and display that excerpt on the home page.

    This is the code I use to display the excerpt on the home page:

    <?php $myposts = get_posts(array('numberposts' => 1, 'post_type' => 'weekly_challenge')); ?>
    <?php foreach( $myposts as $post ) : setup_postdata($post); ?>
                    <div style="padding: 10px; font-family: Arial, Helvetica, Geneva, sans-serif;">
                        <?php the_excerpt(); ?>
                        <div><a href="<?php echo get_home_url( 1, '/weekly-challenge/'); ?>" style="font-size: 10px;">More Weekly Challenges &rarr;</a></div>
    <?php endforeach; ?>

    I am using the PHP Code Widget plugin to paste that same code (minus the padding) into a sidebar widget to show up at, but it doesn’t seem to be working.

    On the blog homepage it displays the first 55 characters excerpt instead of the one I created. On individual blog posts, it pulls the excerpt for the most recent post.

    Any ideas?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘How to Make Post Formats Display in Sidebar’ is closed to new replies.