Yadda Ake Haɗa Posts da Nau'in Buga na Musamman A cikin Tambayoyin WordPress da Ciyarwar RSS

Haɗin WordPress ko Elementor ko Haɗa Posts da Nau'in Buga na Musamman a cikin Tambaya

Ɗaya daga cikin abubuwan ban mamaki na WordPress shine ikon ginawa Nau'in Post Na Musamman. Wannan sassauci yana da kyau… kamar yadda ana iya amfani da nau'ikan post na al'ada don kasuwanci don tsara wasu nau'ikan posts kamar abubuwan da suka faru, wurare, FAQs, abubuwan fayil cikin sauƙi. Kuna iya gina ƙididdigar haraji na al'ada, ƙarin filayen metadata, har ma da samfuran al'ada don nuna su.

A shafin mu a Highbridge, Muna da nau'in post na al'ada da aka saita don ayyukan ban da shafin mu inda muke raba labaran kamfani. Ta hanyar samun nau'in post na al'ada, za mu iya daidaita ayyukan akan shafukan iyawar mu… don haka idan kun duba mu Ayyukan WordPress, Ayyukan da muka yi aiki a kansu waɗanda ke da alaƙa da WordPress za su nuna ta atomatik. Ina aiki tuƙuru don ƙoƙarin tattara duk ayyukanmu domin maziyartan rukunin yanar gizon mu su ga jerin ayyukan da muke yi wa kamfanoni.

Haɗin Saƙonni da Nau'in Buga na Musamman

Shafin gidanmu ya riga ya yi yawa, don haka ba na so in gina wani sashe don rubutun mu na blog DA sashe don sabbin ayyukanmu. Ina so in haɗu biyu posts da ayyuka zuwa cikin fitarwa iri ɗaya ta amfani da maginin samfurin mu, Elementor. Elementor ba shi da abin dubawa don haɗawa ko haɗa posts da nau'ikan post na al'ada, amma abu ne mai sauƙi don yin wannan da kanku!

A cikin shafin ayyukan jigon yaran ku.php, ga misalin yadda ake haɗa waɗannan biyun:

function add_query_news_projects( $query ) {
	if ( is_home() && $query->is_main_query() )
		$query->set( 'post_type', array( 'post', 'project' ) );
	return $query;
}
add_filter( 'pre_get_posts', 'add_query_news_projects' );

Tacewar pre_get_posts yana ba ku damar sabunta tambayar kuma saita ta don samun duka post ɗinku da aikin nau'in post na al'ada. Tabbas, lokacin da kuka rubuta lambar ku kuna buƙatar sabunta nau'in post na al'ada zuwa ainihin taron suna naku.

Haɗa Posts da Nau'in Buga na Musamman a cikin Ciyarwar ku

Har ila yau, ina da rukunin yanar gizon ta atomatik bugawa zuwa kafofin watsa labarun ta hanyar ciyarwa… don haka ni ma ina so in yi amfani da wannan tambaya don saita ciyarwar RSS. Don yin wannan, kawai sai in ƙara sanarwa OR kuma in haɗa is_feedar.

function add_query_news_projects( $query ) {
	if ( is_home() && $query->is_main_query() || is_feed() )
		$query->set( 'post_type', array( 'post', 'project' ) );
	return $query;
}
add_filter( 'pre_get_posts', 'add_query_news_projects' );

Haɗa Saƙonni da Nau'in Buga na Musamman a cikin Elementor

Karin bayanin kula guda… Elementor yana da babban fasalin gaske inda zaku iya suna da adana tambaya a cikin rukunin yanar gizonku. A wannan yanayin, Ina gina tambaya mai suna labarai-projects sannan zan iya kiranta daga mahaɗan mai amfani da Elementor a cikin sashin Tambayar Posts.

function my_query_news_projects( $query ) {
	$query->set( 'post_type', array( 'post', 'project' ) );
}
add_action( 'elementor/query/news-projects', 'my_query_news_projects' );

Anan ga yadda yake kallo a cikin mahallin mai amfani da Elementor:

tambayar elementor posts

Bayyanawa: Ina amfani da nawa Elementor haɗin haɗin gwiwa a cikin wannan labarin.