WordPress.org

Ready to get started?Download WordPress

Forums

PHP Widget Parse Error (1 post)

  1. TydesPerdition
    Member
    Posted 5 years ago #

    So I wanted to plant some PHP code in my sidebar that I had in the index.php of my old theme. The code is meant to display a thumbnail that was defined for the post via the post's meta-data. So I'm using the php-code-widget and I keep getting a parse error:

    Parse error: syntax error, unexpected $end in xxxx/wp-content/plugins/execphp.php(37) : eval()'d code on line 22

    What I'm trying to put in there is this PHP:

    <div id="my-recent-posts">
    <?php query_posts('showposts=3&offset=5'); ?>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <div class="bits"  id="post-<?php the_ID(); ?>">
    <?php $thumb = get_post_meta($post->ID, 'post-thumb', true); ?>
    <?php if ($thumb != null) { ?>
    <div class="post-thumb">
    <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><img src="<?php echo $thumb; ?>" alt="post image" title="<?php the_title_attribute(); ?>"/></a>
    </div>
    <?php } ?>
    <h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
    <div class="postmeta">Posted on <strong><?php the_time('F j, Y') ?></strong> under <?php the_category(', ') ?></div>
    <div class="excerpt">
    <?php the_excerpt(); ?>
    </div>
    <div class="postaction">
    <div class="alignleft"><a href="<?php the_permalink() ?>">Continue Reading</a></div>
    <div class="alignright comment-num"><?php comments_popup_link('0', '1', '%'); ?></div>
    </div>
    </div>

    I'm sure that the error isn't with the plug-in, rather the PHP I'm trying to put into the plug-in won't play nice with it. I just don't know what I'm doing wrong.

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 5 years ago by TydesPerdition
  • This topic is not resolved
  • WordPress version: 2.7.1