Kumaha carana nambahkeun URL artikel ieu dina tungtung artikel WordPress? WP link aslina kode PHP

KumahaWordPressTambihkeun tautan kana téks asli dina tungtung unggal tulisan dina?

Kumaha carana nambahkeun URL artikel ieu di ahir artikel WordPress link conto kode PHP?

使用ramatloka WordPressbabaturan, upami anjeun hoyong nambihan"Lamun artikel aslina dihasilkeun deui, mangga nunjukkeun tumbu ka artikel ieu:”, nu sabenerna cukup basajan.

Ieu mangrupikeun 2 cara pikeun nambihan URL tautan kana tulisan ieu dina tungtung tulisan WordPress anjeun.

???Kahiji, modifikasi template kaca artikel single.php

Dina file template téma WordPress, buka single.php teras milarian kode PHP ieu:

<?php the_content(); ?>

Handapeun baris kode PHP ieu, tambahkeun kode PHP handap▼

<p>原创文章如转载,请注明本文链接: <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_permalink(); ?></a></p>
  • Teras, simpen apdet sareng éta.

?‍?Kadua, tambahkeun kode PHP kana file function.php

Metoda ieu dianjurkeun, teu ngan pikeun nambahkeun tumbu ka kaca log blog, tapi ogé ngawengku feed.

Buka file function.php dina polder téma sareng tambahkeun kode PHP di handap ieu di tungtung (perhatikeun tanda baca Cina sareng Inggris nalika nyalin sareng nempelkeun):

<?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');
?>
  • Mangga modifikasi dumasar kana blog WordPress anjeun.

koméntar

alamat surélék anjeun moal diterbitkeun. Widang anu diperyogikeun dianggo * Labél

Ngagulung ka luhur