-3

I want to use this code in wordpress theme.

    <ul>
  <?php
    $args = array( 'numberposts' => '5' );
    $recent_posts = wp_get_recent_posts( $args );
    foreach( $recent_posts as $recent ){
        echo '<li>
                <span class="l-e-right"><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" rel="bookmark"><?php echo the_post_thumbnail('large-thumb'); ?></a></span>
                    <h4><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h4>
                        <time datetime="<?php the_date('j F Y'); ?>"><?php the_date('j F Y'); ?></time>
                <div class="clearfix"></div>
            </li>'
            }
    wp_reset_query();
  ?>
</ul>

but there is something wrong!

Parse error: syntax error, unexpected 'large' (T_STRING), expecting ',' or ';' in

How can I fix this code?

Thanks...

Siaavash
  • 11
  • 6

3 Answers3

0

You have not cloded tags properly. Try this :

 <?php
    $args = array( 'numberposts' => '5' );
    $recent_posts = wp_get_recent_posts( $args );
    foreach( $recent_posts as $recent ){ ?>
       <li>
                <span class="l-e-right"><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" rel="bookmark"><?php echo the_post_thumbnail('large-thumb'); ?></a></span>
                    <h4><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h4>
                        <time datetime="<?php the_date('j F Y'); ?>"><?php the_date('j F Y'); ?></time>
                <div class="clearfix"></div>
            </li>
   <?php
            }
    wp_reset_query();
  ?>
prakash tank
  • 1,269
  • 1
  • 9
  • 15
0

as a general rule, you fix syntax errors in hard-to-read code by

a) improving the code layout until the error is obvious b) removing the offending code block and gradually putting it back

just somebody
  • 18,602
  • 6
  • 51
  • 60
0

Add a ; at the end of you string (with the generated HTML-Code).

Andy
  • 393
  • 3
  • 16