2016-12-30 2 views
-3

Ich möchte diesen Code in Wordpress Theme verwenden.Wie kann ich diesen Code für Wordpress-Theme beheben

<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> 

aber da stimmt was nicht!

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

Wie kann ich diesen Code beheben?

Danke ...

+2

Unescaped einzelnes Zitat – mathiasfk

+0

Sie können 'echo 'Link' verwenden, um alle diese ' Andy

Antwort

0

Sie haben die Tags nicht richtig gekodet. 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(); 
    ?> 
0

als allgemeine Regel, beheben Sie Syntaxfehler in Code schwer zu lesen von

a) Verbesserung der Code-Layout, bis der Fehler b) Entfernen des problematischen Codes liegt auf der Hand Blockieren und schrittweise zurück setzen

0

Fügen Sie eine ; am Ende der Zeichenfolge (mit dem generierten HTML-Code).

Verwandte Themen