Ayuda técnica
Ayer anduve fozando (que palabra más bonita) en el código del blog para tratar de discriminar los pinbacks/trackbacks de los comentarios en el widget de “Últimos comentarios” de la barra lateral (offline, claro). Conseguí que funcionase, pero a la hora de editar los posts me daba un error y ahí quedaba la cosa:
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\caldeirada\wp-includes\default-widgets.php:1) in C:\xampp\htdocs\caldeirada\wp-includes\pluggable.php on line 868
¿Any idea?
A ver, el código, que antes me lo “malinterpretaba”:
El original
<?php echo $before_widget; ?>
<?php if ( $title ) echo $before_title . $title . $after_title; ?>
<ul id="recentcomments"><?php
if ( $comments ) : foreach ( (array) $comments as $comment) :
echo '<li class="recentcomments">' . /* translators: comments widget: 1: comment author, 2: post link */ sprintf(_x('%1$s on %2$s', 'widgets'), get_comment_author_link(), '<a href="' . esc_url( get_comment_link($comment->comment_ID) ) . '">' . get_the_title($comment->comment_post_ID) . '</a>') . '</li>';
endforeach; endif;?></ul>
<?php echo $after_widget; ?>
El modificado
<?php echo $before_widget; ?>
<?php if ( $title ) echo $before_title . $title . $after_title; ?>
<ul id="recentcomments"><?php
if ( $comments ) { ?>
<?php foreach ( (array) $comments as $comment) { ?>
<?php $tipo = get_comment_type(); ?>
<?php if ( $tipo = 'comment' ) { ?>
<?php echo '<li class="recentcomments">' . /* translators: comments widget: 1: comment author, 2: post link */ sprintf(_x('%1$s on %2$s', 'widgets'), get_comment_author_link(), '<a href="' . esc_url( get_comment_link($comment->comment_ID) ) . '">' . get_the_title($comment->comment_post_ID) . '</a>') . '</li>'; ?>
<?php } ?>
<?php } ?>
<?php } ?></ul>
<?php echo $after_widget; ?>
Responde