Maitiro Ekubatanidza Mapositi uye Tsika Post Types muWordPress Mibvunzo uye RSS Feed

WordPress kana Elementor Batanidza kana Sanganisa Zvinyorwa uye Tsika Yekutumira Marudzi muKubvunza

Chimwe chezvinhu zvinoshamisa zvikuru zveWordPress kugona kuvaka Tsika Post Mhando. Kuchinjika uku kunoshamisa… semhando dzeposvo dzetsika dzinogona kushandiswa kubhizinesi kuronga mamwe marudzi ezvinyorwa senge zviitiko, nzvimbo, FAQs, zvinhu zvepotfolio zviri nyore. Iwe unogona kuvaka tsika taxonomies, mamwe metadata minda, uye kunyange tsika matemplate kuti uvaratidze.

Panzvimbo yedu yepaiti Highbridge, tine tsika yepositi yemhando yakagadzirirwa zvirongwa pamusoro peblog redu kwatiri kugovera nhau dzekambani. Nekuva nerudzi rweposvo, tinokwanisa kuwiriranisa mapurojekiti pamapeji edu ekugona… saka kana ukaona edu WordPress masevhisi, mapurojekiti atakashanda paari ane hukama neWordPress anozozviratidza otomatiki. Ndiri kushanda nesimba ndichiedza kunyora mapurojekiti edu ese kuitira kuti vashanyi vesaiti yedu vaone mabasa mazhinji atinoitira makambani.

Kubatanidza maPosts uye Tsika dzePost Type

Peji yedu yekumba yakatowanda, saka ini ndaisada kuvaka chikamu chezvinyorwa zvedu zveblog UYE chikamu chezvirongwa zvedu zvazvino. Ini ndoda kubatanidza zvese mameseji uye mapurojekiti mune imwechete inobuda uchishandisa yedu template muvaki, Elementor. Elementor haina chinongedzo chekubatanidza kana kusanganisa mapositi uye tsika dzekutumira mhando, asi zviri nyore kuzviita iwe pachako!

Mukati mepeji remwana wako functionaltheme.php, heino muenzaniso wekubatanidza zviviri izvi:

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' );

Iyo pre_get_posts sefa inoita kuti iwe ugadzirise mubvunzo uye woumisa kuti uwane zvese zvako post uye purojekiti custom post type. Ehe, kana iwe ukanyora kodhi yako iwe unozofanirwa kugadzirisa iyo tsika yepositi mhando (s) kune chaiyo yekupa mazita gungano rako.

Kubatanidza maPosts uye Tsika dzePost Type muKudyisa Kwako

Ini zvakare ndine saiti inodhinda yega kumasocial media kuburikidza neyayo feed… saka ndaidawo kushandisa iwo mubvunzo mumwechete kuseta RSS feed. Kuti ndiite izvi, ndaifanira kuwedzera OR chirevo uye kusanganisira i — inopiwa.

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' );

Kubatanidza maPosts uye Tsika dzePost Type muElementor

Imwezve chinyorwa… Elementor ine chinhu chikuru chaunogona kudoma uye kuchengetedza mubvunzo mukati mesaiti yako. Muchiitiko ichi, ndiri kuvaka mubvunzo unonzi nhau-zvirongwa uyezve ndinogona kuidana kubva kuElementor mushandisi interface muPosts Query chikamu.

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

Heano maitiro azvinotaridzika muElementor mushandisi interface:

elementor posts mubvunzo

Kuzivisa: Ndiri kushandisa yangu Elementor affiliate link mune ino chinyorwa.