Directorio de artículos
如何 在WordPressAgregue un enlace al texto original al final de cada artículo en?

使用sitio web de wordpressamigos de , si quieres agregar "Si se reproduce el artículo original, indique el enlace a este artículo:”, que en realidad es bastante simple.
Aquí hay 2 formas de agregar una URL de enlace a este artículo al final de su publicación de WordPress.
??Primero, modifique la plantilla de la página del artículo single.php
En el archivo de plantilla del tema de WordPress, abra single.php y busque el siguiente código PHP:
<?php the_content(); ?>
Debajo de esta línea de código PHP, agregue el siguiente código PHP▼
<p>原创文章如转载,请注明本文链接: <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_permalink(); ?></a></p>
- Luego, guarda la actualización y listo.
??Segundo, agregue el código PHP al archivo function.php
Se recomienda este método, no solo para agregar enlaces a las páginas de registro del blog, sino también para incluir fuentes.
Abra el archivo function.php en la carpeta del tema y agregue el siguiente código PHP al final (tenga en cuenta la puntuación en chino e inglés al copiar y pegar):
<?php function feed_copyright($content) { if(is_single() or is_feed() or is_page()) { $content.= '<div> » 本文来自:<a title="陈沩亮博客" href="https://www.chenweiliang.com/" target="_blank">陈沩亮博客</a> » <a rel="bookmark" title="'.get_the_title().'" href="'.get_permalink().'" target="_blank">《'.get_the_title().'》</a></div>'; $content.= '<div> » 本文链接地址:<a rel="bookmark" title="'.get_the_title().'" href="'.get_permalink().'" target="_blank">'.get_permalink().'</a> »英雄不问来路,转载请注明出处,谢谢。</div>'; $content.= '<div> » 有话想说:<a title="给我留言" href="'.get_permalink().'#respond" target="_blank">那就赶紧去给我留言吧.</a></div>'; $content.= '<div> » 欢迎加入陈沩亮博客的 Telegram 频道:<a rel="external nofollow" title="点此加入陈沩亮博客的 Telegram 频道" href="" target="_blank">https://www.chenweiliang.com/go/tgchannel</a></div>'; } return $content; } add_filter ('the_content', 'feed_copyright'); ?>
- Modifíquelo de acuerdo con su blog de WordPress.
Esperanza Chen Weiliang Blog ( https://www.chenweiliang.com/ ) compartió "¿Cómo agregar la URL de este artículo al final de un artículo de WordPress? Código PHP del enlace original de WP", que es útil para usted.
Bienvenido a compartir el enlace de este artículo:https://www.chenweiliang.com/cwl-1498.html
Para desbloquear más trucos ocultos🔑, ¡bienvenido a unirse a nuestro canal de Telegram!
¡Comparte y dale me gusta si te gusta! ¡Tus acciones y me gusta son nuestra motivación continua!