Sesuaikeun Feed WordPress anjeun nganggo Gambar sareng Pernyataan Hak Cipta (Eusi Pra sareng Pos)
Hiji hal metot ngeunaan WordPress nyaéta yén gambar diulas can kungsi diasupkeun kana RSS tuang. Ieu rada hanjakal, sabab milih atanapi ngarancang gambar anu diulas tiasa narik perhatian kana hiji artikel.
Prepend Eusi Pikeun Tulisan Dina Feed RSS Anjeun
Nyiapkeun gambar anu diulas kana eusi anjeun henteu sesah teuing. Ieu kode anu kuring tambahkeun kana WordPress kuring functions.php
dina abdi Téma anak 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');
Salaku tambahan, kuring ogé hoyong nambihan kontén dina tungtung postingan feed kuring.
Tambahkeun Eusi kana Tulisan Dina Feed RSS Anjeun
Salaku Kuring reviewing backlinks ka Martech Zone, Kuring mindeng manggihan yén aya situs nu maok eusi kuring jeung medarkeun salaku sorangan dina situs maranéhanana. Ieu hiji ngungudag sajajalan jeung aggravating. Aya seueur waktos anu kuring tiasa ngalacak aranjeunna; kali séjén, abdi tiasa ngalaporkeun aranjeunna ka jaringan ad maranéhanana sarta panyadia hosting. Tapi sering, aranjeunna umumna anonim sareng sesah dilacak… upami sadayana.
Hasilna, hiji-hijina pilihan kuring nyaéta pikeun ngaropea feed kuring sareng ngalebetkeun pernyataan hak cipta supados sémah situs anu henteu sah tiasa ningali sumberna. Jang ngalampahkeun ieu, kuring ngamutahirkeun pungsi di luhur pikeun prepend na append informasi kuring hayang.
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');
Anjeun tiasa ningali hasil dina feed kuring… gambar anu diulas ditampilkeun ogé hak cipta sareng tautan sumber asli dina tungtung unggal tulisan.