Ipasibo ang Imong WordPress Feed Uban ang Usa ka Featured Image ug Copyright Statement (Pre and Post Content)
Usa ka makapaikag nga butang bahin sa WordPress mao nga ang gihulagway nga hulagway wala pa gayud gilakip sa RSS pagpakaon. Kini usa ka gamay nga dili maayo, tungod kay ang pagpili o pagdesinyo sa gipakita nga imahe makadani ug daghang atensyon sa usa ka artikulo.
Prepend Content Sa Mga Post Sa Imong RSS Feed
Ang pag-andam sa gipakita nga imahe sa imong sulud dili kaayo lisud. Ania ang code nga akong gidugang sa akong WordPress functions.php
sa akong Tema sa Bata file:
function prerssfeedcontent($content) {
global $post;
$current_year = date('Y');
$post_title = get_the_title( $post->ID );
$post_link = get_permalink( $post->ID );
$post_image = get_the_post_thumbnail( $post->ID, 'medium' );
// Add the featured image
if ( has_post_thumbnail( $post->ID ) ) {
$precontent = '<p class="thumb">';
$precontent .= '<a href="' .$post_link. '" title="' .$post_title. '">';
$precontent .= $post_image;
$precontent .= '</a></p>';
}
$content = $precontent . $content;
return $content;
}
add_filter('the_excerpt_rss', 'prerssfeedcontent');
add_filter('the_content_feed', 'prerssfeedcontent');
Dugang pa, gusto ko usab nga idugang ang sulud sa katapusan sa akong mga post sa feed.
Idugang ang Kontento Sa Mga Post sa Imong RSS Feed
Sa akong pagrepaso sa mga backlink sa Martech Zone, Kanunay nakong makit-an nga adunay mga site nga nangawat sa akong sulud ug gipatik kini nga ilang kaugalingon sa ilang site. Kini usa ka walay katapusan nga paggukod ug pagpasamot. Adunay daghang mga higayon nga masubay nako sila; sa ubang mga higayon, mahimo nako silang i-report sa ilang mga ad network ug hosting providers. Apan kasagaran, sila dili mailhan ug lisud nga masubay… kung naa man.
Ingon usa ka sangputanan, ang akong bugtong kapilian mao ang pag-customize sa akong feed ug paglakip sa usa ka pahayag sa copyright aron ang dili awtorisado nga mga bisita sa site makakita sa gigikanan. Aron mahimo kini, gi-update nako ang function sa ibabaw aron i-prepend ug idugang ang kasayuran nga gusto nako.
function prepostrssfeedcontent($content) {
global $post;
$current_year = date('Y');
$post_title = get_the_title( $post->ID );
$post_link = get_permalink( $post->ID );
$post_image = get_the_post_thumbnail( $post->ID, 'medium' );
$company_title = "DK New Media, LLC";
$company_link = "https://martech.zone/partner/dknewmedia/";
// Add the featured image
if ( has_post_thumbnail( $post->ID ) ) {
$precontent = '<p class="thumb">';
$precontent .= '<a href="' .$post_link. '" title="' .$post_title. '">';
$precontent .= $post_image;
$precontent .= '</a></p>';
}
// Add the copyright
$postcontent = '<p>©';
$postcontent .= $current_year;
$postcontent .= ' <a href="'.$company_link.'">'.$company_title.'</a>, All rights reserved.</p>';
$postcontent .= '<p>Originally Published on Martech Zone: <a href="'.$post_link.'">'.$post_title.'</a></p>';
$content = $precontent . $content . $postcontent;
return $content;
}
add_filter('the_excerpt_rss', 'prepostrssfeedcontent');
add_filter('the_content_feed', 'prepostrssfeedcontent');
Mahimo nimong tan-awon ang resulta sa akong feed… ang gipakita nga imahe gipakita ingon man ang copyright ug orihinal nga gigikanan nga mga link sa katapusan sa matag post.