Yuav Ua Li Cas Muab Cov Ntawv Tshaj Tawm thiab Kev Cai Tshaj Tawm Hom Hauv WordPress Cov Lus Nug thiab RSS Pub

WordPress los yog Elementor Merge los yog sib sau cov ntawv thiab Custom Post Types in Query

Ib qho zoo kawg nkaus nta ntawm WordPress yog lub peev xwm los tsim Hom Ncej Kev Cai. Qhov kev hloov pauv no yog qhov zoo heev… raws li kev cai tshaj tawm hom tuaj yeem siv rau kev lag luam los teeb tsa lwm hom kev tshaj tawm xws li cov xwm txheej, qhov chaw, FAQs, cov khoom lag luam yooj yim. Koj tuaj yeem tsim cov kev cai taxonomies, ntxiv metadata teb, thiab txawm tias cov qauv kev cai los tso saib lawv.

Ntawm peb qhov chaw ntawm Highbridge, peb muaj kev cai ncej hom teem rau tej yaam num ntxiv rau peb qhov blog uas peb tab tom sib koom xov xwm tuam txhab. Los ntawm muaj ib hom kev cai tshaj tawm, peb tuaj yeem kho cov haujlwm ntawm peb nplooj ntawv muaj peev xwm… yog li yog tias koj saib peb Cov kev pabcuam WordPress, cov haujlwm uas peb tau ua haujlwm uas yog WordPress-txog yuav tau tso tawm. Kuv nyuaj ntawm kev ua haujlwm sim sau tag nrho peb cov haujlwm kom peb cov neeg tuaj saib hauv lub xaib tuaj yeem pom cov haujlwm peb ua rau cov tuam txhab.

Kev sib koom ua ke ntawm cov ntawv tshaj tawm thiab kev cai Post hom

Peb lub tsev nplooj ntawv twb tau dav heev, yog li kuv tsis xav tau los tsim ib ntu rau peb cov ntawv blog THIAB ib ntu rau peb cov haujlwm tshiab. Kuv xav muab ob qho tib si posts thiab tej yaam num rau hauv tib cov zis siv peb template builder, Elementor. Elementor tsis muaj qhov cuam tshuam rau kev sib koom ua ke lossis muab cov ntawv tshaj tawm thiab kev cai tshaj tawm hom, tab sis nws yooj yim heev los ua qhov no koj tus kheej!

Nyob rau hauv koj tus me nyuam lub ntsiab functions.php nplooj ntawv, ntawm no yog ib qho piv txwv ntawm yuav ua li cas muab ob:

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

Cov lim dej pre_get_posts tso cai rau koj hloov kho cov lus nug thiab teeb tsa kom tau txais koj cov ntawv tshaj tawm thiab project kev cai ncej hom. Tau kawg, thaum koj sau koj cov lej koj yuav tsum tau hloov kho cov kev cai tshaj tawm hom (s) rau lub npe tiag tiag ntawm koj li.

Kev sib koom ua ke cov ntawv tshaj tawm thiab kev cai tshaj tawm hom hauv koj cov khoom noj

Kuv kuj muaj lub vev xaib tau tshaj tawm rau kev tshaj xov xwm ntawm nws qhov pub… yog li kuv kuj xav siv tib cov lus nug los teeb tsa RSS pub. Ua li no, kuv tsuas yog yuav tsum tau ntxiv ib nqe lus LOSSIS thiab suav nrog is_cov.

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

Kev sib koom ua ke Posts thiab Custom Post Hom hauv Elementor

Ib qho ntxiv… Elementor muaj qhov zoo heev uas koj tuaj yeem sau npe thiab khaws cov lus nug hauv koj qhov chaw. Hauv qhov no, kuv tab tom tsim cov lus nug hu ua xov xwm-cov phiaj xwm thiab tom qab ntawd kuv tuaj yeem hu nws los ntawm Elementor tus neeg siv interface hauv ntu lus nug.

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

Nov yog qhov nws zoo li hauv Elementor tus neeg siv interface:

elementor cov lus nug

Kev tshaj tawm: Kuv tabtom siv kuv Elementor affiliate link hauv kab lus no.