Skip to content

Total Theme: Add Author Metabox for Testimonials CPT if Theme Metabox is disabled

/**
	 * Register custom fields.
	 *
	 * @link https://total.wpexplorer.com/docs/snippets/add-custom-metaboxes-to-total/
	 */
function enym_testimonials_metaboxes() {
	if ( ! class_exists( 'WPEX_Meta_Factory' ) ) {
		return;
	}

	new WPEX_Meta_Factory(  array(
		'id'       => 'event_data',
		'title'    => esc_html__( 'Autor', 'text_domain' ),
		'screen'   => array( 'testimonials' ), //post types to add the metabox to
		'context'  => 'side',
		'priority' => 'default',
		// @important since Total Theme Core v1.7.1 you can now pass a function that returns the fields to prevent
		// the fields from being stored in memory and so they are only called when needed.
		'fields'   => array(

			array(
				'name' => esc_html__( 'Name' ),
				'id'   => 'wpex_testimonial_author',
				'desc' => esc_html__( 'Im Frontend angezeigter Name', 'enym' ),
				'type' => 'text',
			),
			array(
				'name' => esc_html__( 'Unternehmen' ),
				'id'   => 'wpex_testimonial_company',
				'desc' => esc_html__( 'Unternehmen oder Untertitel', 'enym' ),
				'type' => 'text',
			),
			array(
				'name' => esc_html__( 'Internetseite' ),
				'id'   => 'wpex_testimonial_url',
				'desc' => esc_html__( 'Web-Adresse des Unternehmens', 'enym' ),
				'type' => 'url',
			),
			array(
				'name' => esc_html__( 'Bewertung' ),
				'id'   => 'wpex_post_rating',
				'desc' => esc_html__( 'Auf einer Skala von 1-10', 'enym' ),
				'type' => 'text',
			),

		)
	) );
}
add_action( 'admin_init', 'enym_testimonials_metaboxes' );

Dieser Beitrag hat 0 Kommentare

Schreibe einen Kommentar

Deine E-Mail wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

An den Anfang scrollen