כיצד למנוע מ-PBS להופיע

כיצד למנוע מ-PBS להופיע

באפשרותך למנוע מ-PB Sandwich להופיע בצד הלקוח (front-end) באמצעות המסנן pbs_is_editable_by_user.

לדוגמה, כדי למנוע מ-PB Sandwich להופיע בסוג פוסט מותאם אישית (Custom Post Type) המזוהה על ידי המזהה (slug) slider, תוכל להוסיף קטע קוד זה בקובץ ה-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;
}

כדי לעצור את 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;
}