';
}
}
/**
* CSS option type.
*
* See @alchem_display_by_type to see the full list of available arguments.
*
* @param array An array of arguments.
* @return string
*
* @access public
* @since 2.0
*/
if ( ! function_exists( 'alchem_type_css' ) ) {
function alchem_type_css( $args = array() ) {
/* turns arguments array into variables */
extract( $args );
/* verify a description */
$has_desc = $field_desc ? true : false;
/* format setting outer wrapper */
echo '
';
/* description */
echo $has_desc ? '
' . htmlspecialchars_decode( $field_desc ) . '
' : '';
/* format setting inner wrapper */
echo '
';
/* build textarea for CSS */
echo '';
/* build pre to convert it into ace editor later */
echo '
' . esc_textarea( $field_value ) . '
';
echo '
';
echo '
';
}
}
/**
* Custom Post Type Checkbox option type.
*
* See @alchem_display_by_type to see the full list of available arguments.
*
* @param array An array of arguments.
* @return string
*
* @access public
* @since 2.0
*/
if ( ! function_exists( 'alchem_type_custom_post_type_checkbox' ) ) {
function alchem_type_custom_post_type_checkbox( $args = array() ) {
/* turns arguments array into variables */
extract( $args );
/* verify a description */
$has_desc = $field_desc ? true : false;
/* format setting outer wrapper */
echo '
';
}
}
/**
* Custom Post Type Select option type.
*
* See @alchem_display_by_type to see the full list of available arguments.
*
* @param array An array of arguments.
* @return string
*
* @access public
* @since 2.0
*/
if ( ! function_exists( 'alchem_type_custom_post_type_select' ) ) {
function alchem_type_custom_post_type_select( $args = array() ) {
/* turns arguments array into variables */
extract( $args );
/* verify a description */
$has_desc = $field_desc ? true : false;
/* format setting outer wrapper */
echo '
';
/* description */
echo $has_desc ? '
' . htmlspecialchars_decode( $field_desc ) . '
' : '';
/* format setting inner wrapper */
echo '
';
/* build category */
echo '';
echo '
';
echo '
';
}
}
/**
* Date Picker option type.
*
* See @alchem_display_by_type to see the full list of available arguments.
*
* @param array An array of arguments.
* @return string
*
* @access public
* @since 2.3
*/
if ( ! function_exists( 'alchem_type_date_picker' ) ) {
function alchem_type_date_picker( $args = array() ) {
/* turns arguments array into variables */
extract( $args );
/* verify a description */
$has_desc = $field_desc ? true : false;
/* filter date format */
$date_format = apply_filters( 'alchem_type_date_picker_date_format', 'yy-mm-dd', $field_id );
/* format setting outer wrapper */
echo '
';
}
}
/**
* Date Time Picker option type.
*
* See @alchem_display_by_type to see the full list of available arguments.
*
* @param array An array of arguments.
* @return string
*
* @access public
* @since 2.3
*/
if ( ! function_exists( 'alchem_type_date_time_picker' ) ) {
function alchem_type_date_time_picker( $args = array() ) {
/* turns arguments array into variables */
extract( $args );
/* verify a description */
$has_desc = $field_desc ? true : false;
/* filter date format */
$date_format = apply_filters( 'alchem_type_date_time_picker_date_format', 'yy-mm-dd', $field_id );
/* format setting outer wrapper */
echo '
';
/* date time picker JS */
echo '';
/* description */
echo $has_desc ? '
' . htmlspecialchars_decode( $field_desc ) . '
' : '';
/* format setting inner wrapper */
echo '
';
/* build date time picker */
echo '';
echo '
';
echo '
';
}
}
/**
* Gallery option type.
*
* See @alchem_display_by_type to see the full list of available arguments.
*
* @param array The options arguments
* @return string The gallery metabox markup.
*
* @access public
* @since 2.2.0
*/
if ( ! function_exists( 'alchem_type_gallery' ) ) {
function alchem_type_gallery( $args = array() ) {
// Turns arguments array into variables
extract( $args );
// Verify a description
$has_desc = $field_desc ? true : false;
// Format setting outer wrapper
echo '
';
// Description
echo $has_desc ? '
' . htmlspecialchars_decode( $field_desc ) . '
' : '';
// Format setting inner wrapper
echo '
';
// Setup the post type
$post_type = isset( $field_post_type ) ? explode( ',', $field_post_type ) : array( 'post' );
$field_value = trim( $field_value );
// Saved values
echo '';
// Search the string for the IDs
preg_match( '/ids=\'(.*?)\'/', $field_value, $matches );
// Turn the field value into an array of IDs
if ( isset( $matches[1] ) ) {
// The string is a shortcode
$ids = explode( ',', $matches[1] );
} else {
// The string is a comma separated list of IDs
$ids = ! empty( $field_value ) && $field_value != '' ? explode( ',', $field_value ) : array();
}
// Has attachment IDs
if ( ! empty( $ids ) ) {
echo '
';
}
}
/**
* List Item option type.
*
* See @alchem_display_by_type to see the full list of available arguments.
*
* @param array An array of arguments.
* @return string
*
* @access public
* @since 2.0
*/
if ( ! function_exists( 'alchem_type_list_item' ) ) {
function alchem_type_list_item( $args = array() ) {
/* turns arguments array into variables */
extract( $args );
/* verify a description */
$has_desc = $field_desc ? true : false;
/* format setting outer wrapper */
echo '
';
/* description */
echo $has_desc ? '
' . htmlspecialchars_decode( $field_desc ) . '
' : '';
/* format setting inner wrapper */
echo '
';
/* pass the settings array arround */
echo '';
/**
* settings pages have array wrappers like 'option_tree'.
* So we need that value to create a proper array to save to.
* This is only for NON metaboxes settings.
*/
if ( ! isset( $get_option ) )
$get_option = '';
/* build list items */
echo '
' . apply_filters( 'alchem_list_item_description', __( 'You can re-order with drag & drop, the order will update after saving.', 'alchem' ), $field_id ) . '
';
echo '
';
echo '
';
}
}
/**
* Measurement option type.
*
* See @alchem_display_by_type to see the full list of available arguments.
*
* @param array An array of arguments.
* @return string
*
* @access public
* @since 2.0
*/
if ( ! function_exists( 'alchem_type_measurement' ) ) {
function alchem_type_measurement( $args = array() ) {
/* turns arguments array into variables */
extract( $args );
/* verify a description */
$has_desc = $field_desc ? true : false;
/* format setting outer wrapper */
echo '
';
/* description */
echo $has_desc ? '
' . htmlspecialchars_decode( $field_desc ) . '
' : '';
/* format setting inner wrapper */
echo '
';
echo '
';
echo '';
echo '
';
/* build measurement */
echo '';
echo '
';
echo '
';
}
}
/**
* Numeric Slider option type.
*
* See @alchem_display_by_type to see the full list of available arguments.
*
* @param array An array of arguments.
* @return string
*
* @access public
* @since 2.1
*/
if( ! function_exists( 'alchem_type_numeric_slider' ) ) {
function alchem_type_numeric_slider( $args = array() ) {
/* turns arguments array into variables */
extract( $args );
/* verify a description */
$has_desc = $field_desc ? true : false;
$_options = explode( ',', $field_min_max_step );
$min = isset( $_options[0] ) ? $_options[0] : 0;
$max = isset( $_options[1] ) ? $_options[1] : 100;
$step = isset( $_options[2] ) ? $_options[2] : 1;
/* format setting outer wrapper */
echo '
';
/* description */
echo $has_desc ? '
' . htmlspecialchars_decode( $field_desc ) . '
' : '';
/* format setting inner wrapper */
echo '
';
echo '
';
echo '';
echo '';
echo '';
echo '
';
echo '
';
echo '
';
}
}
/**
* On/Off option type
*
* See @alchem_display_by_type to see the full list of available arguments.
*
* @param array The options arguments
* @return string The gallery metabox markup.
*
* @access public
* @since 2.2.0
*/
if ( ! function_exists( 'alchem_type_on_off' ) ) {
function alchem_type_on_off( $args = array() ) {
/* turns arguments array into variables */
extract( $args );
/* verify a description */
$has_desc = $field_desc ? true : false;
/* format setting outer wrapper */
echo '
';
}
}
/**
* Page Select option type.
*
* See @alchem_display_by_type to see the full list of available arguments.
*
* @param array An array of arguments.
* @return string
*
* @access public
* @since 2.0
*/
if ( ! function_exists( 'alchem_type_page_select' ) ) {
function alchem_type_page_select( $args = array() ) {
/* turns arguments array into variables */
extract( $args );
/* verify a description */
$has_desc = $field_desc ? true : false;
/* format setting outer wrapper */
echo '
';
/* description */
echo $has_desc ? '
' . htmlspecialchars_decode( $field_desc ) . '
' : '';
/* format setting inner wrapper */
echo '
';
/* build page select */
echo '';
echo '
';
echo '
';
}
}
/**
* List Item option type.
*
* See @alchem_display_by_type to see the full list of available arguments.
*
* @param array An array of arguments.
* @return string
*
* @access public
* @since 2.0
*/
if ( ! function_exists( 'alchem_type_slider' ) ) {
function alchem_type_slider( $args = array() ) {
/* turns arguments array into variables */
extract( $args );
/* verify a description */
$has_desc = $field_desc ? true : false;
/* format setting outer wrapper */
echo '
';
/* description */
echo $has_desc ? '
' . htmlspecialchars_decode( $field_desc ) . '
' : '';
/* format setting inner wrapper */
echo '
';
/* pass the settings array arround */
echo '';
/**
* settings pages have array wrappers like 'option_tree'.
* So we need that value to create a proper array to save to.
* This is only for NON metaboxes settings.
*/
if ( ! isset( $get_option ) )
$get_option = '';
/* build list items */
echo '
' . __( 'You can re-order with drag & drop, the order will update after saving.', 'alchem' ) . '
';
echo '
';
echo '
';
}
}
/**
* Post Checkbox option type.
*
* See @alchem_display_by_type to see the full list of available arguments.
*
* @param array An array of arguments.
* @return string
*
* @access public
* @since 2.0
*/
if ( ! function_exists( 'alchem_type_post_checkbox' ) ) {
function alchem_type_post_checkbox( $args = array() ) {
/* turns arguments array into variables */
extract( $args );
/* verify a description */
$has_desc = $field_desc ? true : false;
/* format setting outer wrapper */
echo '
';
}
}
/**
* Post Select option type.
*
* See @alchem_display_by_type to see the full list of available arguments.
*
* @param array An array of arguments.
* @return string
*
* @access public
* @since 2.0
*/
if ( ! function_exists( 'alchem_type_post_select' ) ) {
function alchem_type_post_select( $args = array() ) {
/* turns arguments array into variables */
extract( $args );
/* verify a description */
$has_desc = $field_desc ? true : false;
/* format setting outer wrapper */
echo '
';
/* description */
echo $has_desc ? '
' . htmlspecialchars_decode( $field_desc ) . '
' : '';
/* format setting inner wrapper */
echo '
';
/* build page select */
echo '';
echo '
';
echo '
';
}
}
/**
* Radio option type.
*
* See @alchem_display_by_type to see the full list of available arguments.
*
* @param array An array of arguments.
* @return string
*
* @access public
* @since 2.0
*/
if ( ! function_exists( 'alchem_type_radio' ) ) {
function alchem_type_radio( $args = array() ) {
/* turns arguments array into variables */
extract( $args );
/* verify a description */
$has_desc = $field_desc ? true : false;
/* format setting outer wrapper */
echo '
';
/* description */
echo $has_desc ? '
' . htmlspecialchars_decode( $field_desc ) . '
' : '';
/* format setting inner wrapper */
echo '
';
/* build radio */
foreach ( (array) $field_choices as $key => $choice ) {
echo '';
}
echo '
';
echo '
';
}
}
/**
* Radio Images option type.
*
* See @alchem_display_by_type to see the full list of available arguments.
*
* @param array An array of arguments.
* @return string
*
* @access public
* @since 2.0
*/
if ( ! function_exists( 'alchem_type_radio_image' ) ) {
function alchem_type_radio_image( $args = array() ) {
/* turns arguments array into variables */
extract( $args );
/* verify a description */
$has_desc = $field_desc ? true : false;
/* format setting outer wrapper */
echo '
';
/* description */
echo $has_desc ? '
' . htmlspecialchars_decode( $field_desc ) . '
' : '';
/* format setting inner wrapper */
echo '
';
/**
* load the default filterable images if nothing
* has been set in the choices array.
*/
if ( empty( $field_choices ) )
$field_choices = alchem_radio_images( $field_id );
/* build radio image */
foreach ( (array) $field_choices as $key => $choice ) {
$src = str_replace( 'ALCHEM_THEME_URI', ALCHEM_THEME_URI, $choice['src'] );
// $src = str_replace( 'alchem_THEME_URL', alchem_THEME_URL, $src );
/* make radio image source filterable */
$src = apply_filters( 'alchem_type_radio_image_src', $src, $field_id );
echo '
';
echo '';
echo '';
echo '
';
}
echo '
';
echo '
';
}
}
/**
* Select option type.
*
* See @alchem_display_by_type to see the full list of available arguments.
*
* @param array An array of arguments.
* @return string
*
* @access public
* @since 2.0
*/
if ( ! function_exists( 'alchem_type_select' ) ) {
function alchem_type_select( $args = array() ) {
/* turns arguments array into variables */
extract( $args );
/* verify a description */
$has_desc = $field_desc ? true : false;
/* format setting outer wrapper */
echo '
';
/* description */
echo $has_desc ? '
' . htmlspecialchars_decode( $field_desc ) . '
' : '';
/* format setting inner wrapper */
echo '
';
/* build select */
echo '';
echo '
';
echo '
';
}
}
/**
* Sidebar Select option type.
*
* This option type makes it possible for users to select a WordPress registered sidebar
* to use on a specific area. By using the two provided filters, 'alchem_recognized_sidebars',
* and 'alchem_recognized_sidebars_{$field_id}' we can be selective about which sidebars are
* available on a specific content area.
*
* For example, if we create a WordPress theme that provides the ability to change the
* Blog Sidebar and we don't want to have the footer sidebars available on this area,
* we can unset those sidebars either manually or by using a regular expression if we
* have a common name like footer-sidebar-$i.
*
* @param array An array of arguments.
* @return string
*
* @access public
* @since 2.1
*/
if ( ! function_exists( 'alchem_type_sidebar_select' ) ) {
function alchem_type_sidebar_select( $args = array() ) {
/* turns arguments array into variables */
extract( $args );
/* verify a description */
$has_desc = $field_desc ? true : false;
/* format setting outer wrapper */
echo '
';
/* description */
echo $has_desc ? '
' . htmlspecialchars_decode( $field_desc ) . '
' : '';
/* format setting inner wrapper */
echo '
';
/* build page select */
echo '';
echo '
';
echo '
';
}
}
/**
* Tab option type.
*
* See @alchem_display_by_type to see the full list of available arguments.
*
* @param array An array of arguments.
* @return string
*
* @access public
* @since 2.3.0
*/
if ( ! function_exists( 'alchem_type_tab' ) ) {
function alchem_type_tab( $args = array() ) {
/* turns arguments array into variables */
extract( $args );
/* format setting outer wrapper */
echo '
';
echo ' ';
echo '
';
}
}
/**
* Tag Checkbox option type.
*
* See @alchem_display_by_type to see the full list of available arguments.
*
* @param array An array of arguments.
* @return string
*
* @access public
* @since 2.0
*/
if ( ! function_exists( 'alchem_type_tag_checkbox' ) ) {
function alchem_type_tag_checkbox( $args = array() ) {
/* turns arguments array into variables */
extract( $args );
/* verify a description */
$has_desc = $field_desc ? true : false;
/* format setting outer wrapper */
echo '
';
/* description */
echo $has_desc ? '
' . htmlspecialchars_decode( $field_desc ) . '
' : '';
/* format setting inner wrapper */
echo '
';
/* get tags */
$tags = get_tags( array( 'hide_empty' => false ) );
/* has tags */
if ( $tags ) {
foreach( $tags as $tag ) {
echo '
';
}
}
/**
* Tag Select option type.
*
* See @alchem_display_by_type to see the full list of available arguments.
*
* @param array An array of arguments.
* @return string
*
* @access public
* @since 2.0
*/
if ( ! function_exists( 'alchem_type_tag_select' ) ) {
function alchem_type_tag_select( $args = array() ) {
/* turns arguments array into variables */
extract( $args );
/* verify a description */
$has_desc = $field_desc ? true : false;
/* format setting outer wrapper */
echo '
';
/* description */
echo $has_desc ? '
' . htmlspecialchars_decode( $field_desc ) . '
' : '';
/* format setting inner wrapper */
echo '
';
/* build tag select */
echo '';
echo '
';
echo '
';
}
}
/**
* Taxonomy Checkbox option type.
*
* See @alchem_display_by_type to see the full list of available arguments.
*
* @param array An array of arguments.
* @return string
*
* @access public
* @since 2.0
*/
if ( ! function_exists( 'alchem_type_taxonomy_checkbox' ) ) {
function alchem_type_taxonomy_checkbox( $args = array() ) {
/* turns arguments array into variables */
extract( $args );
/* verify a description */
$has_desc = $field_desc ? true : false;
/* format setting outer wrapper */
echo '
';
}
}
/**
* Taxonomy Select option type.
*
* See @alchem_display_by_type to see the full list of available arguments.
*
* @param array An array of arguments.
* @return string
*
* @access public
* @since 2.0
*/
if ( ! function_exists( 'alchem_type_taxonomy_select' ) ) {
function alchem_type_taxonomy_select( $args = array() ) {
/* turns arguments array into variables */
extract( $args );
/* verify a description */
$has_desc = $field_desc ? true : false;
/* format setting outer wrapper */
echo '
';
/* description */
echo $has_desc ? '
' . htmlspecialchars_decode( $field_desc ) . '
' : '';
/* format setting inner wrapper */
echo '
';
/* build tag select */
echo '';
echo '
';
echo '
';
}
}
/**
* Text option type.
*
* See @alchem_display_by_type to see the full list of available arguments.
*
* @param array An array of arguments.
* @return string
*
* @access public
* @since 2.0
*/
if ( ! function_exists( 'alchem_type_text' ) ) {
function alchem_type_text( $args = array() ) {
/* turns arguments array into variables */
extract( $args );
/* verify a description */
$has_desc = $field_desc ? true : false;
/* format setting outer wrapper */
echo '
';
/* description */
echo $has_desc ? '
' . htmlspecialchars_decode( $field_desc ) . '
' : '';
/* format setting inner wrapper */
echo '
';
/* build text input */
echo '';
echo '
';
echo '
';
}
}
/**
* Textarea option type.
*
* See @alchem_display_by_type to see the full list of available arguments.
*
* @param array An array of arguments.
* @return string
*
* @access public
* @since 2.0
*/
if ( ! function_exists( 'alchem_type_textarea' ) ) {
function alchem_type_textarea( $args = array() ) {
/* turns arguments array into variables */
extract( $args );
/* verify a description */
$has_desc = $field_desc ? true : false;
/* format setting outer wrapper */
echo '
';
}
}
/**
* Textblock option type.
*
* See @alchem_display_by_type to see the full list of available arguments.
*
* @param array An array of arguments.
* @return string
*
* @access public
* @since 2.0
*/
if ( ! function_exists( 'alchem_type_textblock' ) ) {
function alchem_type_textblock( $args = array() ) {
/* turns arguments array into variables */
extract( $args );
/* format setting outer wrapper */
echo '
';
/* description */
echo '
' . htmlspecialchars_decode( $field_desc ) . '
';
echo '
';
}
}
/**
* Textblock Titled option type.
*
* See @alchem_display_by_type to see the full list of available arguments.
*
* @param array An array of arguments.
* @return string
*
* @access public
* @since 2.0
*/
if ( ! function_exists( 'alchem_type_textblock_titled' ) ) {
function alchem_type_textblock_titled( $args = array() ) {
/* turns arguments array into variables */
extract( $args );
/* format setting outer wrapper */
echo '
';
/* description */
echo '
' . htmlspecialchars_decode( $field_desc ) . '
';
echo '
';
}
}
/**
* Typography option type.
*
* See @alchem_display_by_type to see the full list of available arguments.
*
* @param array An array of arguments.
* @return string
*
* @access public
* @since 2.0
*/
if ( ! function_exists( 'alchem_type_typography' ) ) {
function alchem_type_typography( $args = array() ) {
/* turns arguments array into variables */
extract( $args );
/* verify a description */
$has_desc = $field_desc ? true : false;
/* format setting outer wrapper */
echo '
';
/* description */
echo $has_desc ? '
' . htmlspecialchars_decode( $field_desc ) . '
' : '';
/* format setting inner wrapper */
echo '
';
/* allow fields to be filtered */
$alchem_recognized_typography_fields = apply_filters( 'alchem_recognized_typography_fields', array(
'font-color',
'font-family',
'font-size',
'font-style',
'font-variant',
'font-weight',
'letter-spacing',
'line-height',
'text-decoration',
'text-transform'
), $field_id );
/* build font color */
if ( in_array( 'font-color', $alchem_recognized_typography_fields ) ) {
/* build colorpicker */
echo '