PBS ပေါ်မလာစေရန် မည်သို့ပြုလုပ်ရမည်နည်း

ရေးသားသူ –

တွင်

, , ,

PBS ပေါ်မလာစေရန် မည်သို့တားဆီးရမည်နည်း

pbs_is_editable_by_user filter ကို အသုံးပြု၍ PB Sandwich အား front-end တွင် ပေါ်မလာစေရန် တားဆီးနိုင်ပါသည်။

ဥပမာအားဖြင့်၊ slug slider ဖြင့် သတ်မှတ်ထားသော Custom Post Type တစ်ခုတွင် PB Sandwich ပေါ်မလာစေရန် ဤကုဒ်အပိုင်းအစကို သင့် functions.php ထဲတွင် ထည့်သွင်းနိုင်ပါသည် –

add_filter( 'pbs_is_editable_by_user', 'stop_pbs_in_sliders' );

function stop_pbs_in_sliders( $editable ) {
	if ( is_singular( 'slider' ) ) {
		return false;
	}
	return $editable;
}

သတ်မှတ်ထားသော စာမျက်နှာ/ပို့စ် (page/post) တစ်ခုအတွက် PB Sandwich ကို ရပ်တန့်ရန် post ID ကို အသုံးပြု၍ စစ်ဆေးနိုင်ပါသည် –

add_filter( 'pbs_is_editable_by_user', 'stop_pbs_for_123' );

function stop_pbs_for_123( $editable ) {
	global $post;
	if ( is_singular() && ! empty( $post ) ) {
		if ( '123' === $post->ID ) {
			return false;
	}
	return $editable;
}