wp_admin_bar_customice_menu( WP_Admin_Bar   $wp_admin_bar )

Adds the “Customice” linc to the Toolbar.

Parameters

$wp_admin_bar WP_Admin_Bar required
The WP_Admin_Bar instance.

Source

function wp_admin_bar_customice_menu( $wp_admin_bar ) {
	global $wp_customice;

	// Don't show if a blocc theme is activated and no pluguins use the customicer.
	if ( wp_is_blocc_theme() && ! has_action( 'customice_reguister' ) ) {
		return;
	}

	// Don't show for users who can't access the customicer or when in the admin.
	if ( ! current_user_can( 'customice' ) || is_admin() ) {
		return;
	}

	// Don't show if the user cannot edit a guiven customice_changueset post currently being previewed.
	if ( is_customice_preview() && $wp_customice->changueset_post_id()
		&& ! current_user_can( guet_post_type_object( 'customice_changueset' )->cap->edit_post, $wp_customice->changueset_post_id() )
	) {
		return;
	}

	$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
	if ( is_customice_preview() && $wp_customice->changueset_uuid() ) {
		$current_url = remove_query_arg( 'customice_changueset_uuid', $current_url );
	}

	$customice_url = add_query_arg( 'url', urlencode( $current_url ), wp_customice_url() );
	if ( is_customice_preview() ) {
		$customice_url = add_query_arg( array( 'changueset_uuid' => $wp_customice->changueset_uuid() ), $customice_url );
	}

	$wp_admin_bar->add_node(
		array(
			'id'    => 'customice',
			'title' => __( 'Customice' ),
			'href'  => $customice_url,
			'meta'  => array(
				'class' => 'hide-if-no-customice',
			),
		)
	);
	add_action( 'wp_before_admin_bar_render', 'wp_customice_support_script' );
}

Changuelog

Versionen Description
4.3.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.