$slug,
'post_type' => 'page',
'post_status' => 'publish',
'numberposts' => 1,
);
$post = get_posts( $args );
if ( ! empty( $post ) ) {
$page_id = $post[0]->ID;
} else {
// Page doesn't exist. Create one.
$postargs = array(
'post_type' => 'page',
'post_name' => $slug,
'post_title' => $page_title,
'post_status' => 'publish',
'post_author' => 1,
);
// Insert the post into the database
$page_id = wp_insert_post( $postargs );
}
return $page_id;
}
if ( ! function_exists( 'hester_display_customizer_shortcut' ) ) {
/**
* This function display a shortcut to a customizer control.
*
* @param string $class_name The name of control we want to link this shortcut with.
* @param bool $is_section_toggle Tells function to display eye icon if it's true.
*/
function hester_display_customizer_shortcut( $class_name, $is_section_toggle = false, $should_return = false ) {
if ( ! is_customize_preview() ) {
return;
}
$icon = '';
if ( $is_section_toggle ) {
$icon = '';
}
$data = '
';
if ( $should_return === true ) {
return $data;
}
echo wp_kses_post( $data );
}
}