__( 'Projects tags', 'mustang-lite' ), 'all' => false, 'hierarchical' => '0', 'tax_name' => 'project_tag', ); //Output return $taxonomies; } // /wm_widgets_posts_taxonomies add_filter( 'wmhook_widgets_wm_posts_widget_form_taxonomy', 'wm_widgets_posts_taxonomies' ); /** * Instance defaults * * @param array $defaults */ function wm_widgets_posts_instance_defaults( $defaults = array() ) { //Preparing output $defaults['layout'] = array( 'post' => 'widget', 'wm_projects' => 'widget', ); //Output return $defaults; } // /wm_widgets_posts_instance_defaults add_filter( 'wmhook_widgets_wm_posts_widget_defaults', 'wm_widgets_posts_instance_defaults' ); /** * CUSTOM METABOXES */ if ( function_exists( 'wma_add_meta_box' ) ) { /** * Post metaboxex */ /** * Post formats info metafields * * @param array $fields Array of predefined metafields * * @return array Modified $fields array */ function wm_post_formats_metafields( $fields = array() ) { $fields[20] = array( 'id' => 'post-format-audio', 'type' => 'html', 'content' => '
' . __( '

Audio post format

Displays audio player to play your audio files. Could be used for Podcasting. Please place the [wm_audio] shortcode as the first thing in post content. The audio description text can follow on next line.', 'mustang-lite' ) . '
', 'conditional' => array( 'option' => array( 'tag' => 'input', 'name' => 'post_format', 'type' => 'radio', ), 'option_value' => array( 'audio' ), 'operand' => 'IS', ), ); $fields[25] = array( 'id' => 'post-format-gallery', 'type' => 'html', 'content' => '
' . __( '

Gallery post format

A standard post with a gallery of images in post content. Slideshow will be displayed on blog page from the first gallery found in post content. If no gallery found, featured image is displayed.
You can insert a [gallery] shortcode anywhere in the post. This shortcode will not be stripped out from the post content on the single post page.', 'mustang-lite' ) . '
', 'conditional' => array( 'option' => array( 'tag' => 'input', 'name' => 'post_format', 'type' => 'radio', ), 'option_value' => array( 'gallery' ), 'operand' => 'IS', ), ); $fields[30] = array( 'id' => 'post-format-link', 'type' => 'html', 'content' => '
' . __( '

Link post format

Promotes interesting URL links. You can set the link anywhere in the post content. The link will be emphasized when post is displayed.', 'mustang-lite' ) . '
' . __( 'Post title will not be displayed.', 'mustang-lite' ) . '
', 'conditional' => array( 'option' => array( 'tag' => 'input', 'name' => 'post_format', 'type' => 'radio', ), 'option_value' => array( 'link' ), 'operand' => 'IS', ), ); $fields[35] = array( 'id' => 'post-format-quote', 'type' => 'html', 'content' => '
' . __( '

Quote post format

A quotation. Please place the actual quote (blockquote) directly into post content. To set a quote source use a <cite> HTML tag.', 'mustang-lite' ) . '
' . __( 'Post title will not be displayed.', 'mustang-lite' ) . '
', 'conditional' => array( 'option' => array( 'tag' => 'input', 'name' => 'post_format', 'type' => 'radio', ), 'option_value' => array( 'quote' ), 'operand' => 'IS', ), ); $fields[40] = array( 'id' => 'post-format-status', 'type' => 'html', 'content' => '
' . __( '

Status post format

A short status update, similar to a Twitter status update. Please place the actual status text directly into post content area.', 'mustang-lite' ) . '
' . __( 'Post title will not be displayed.', 'mustang-lite' ) . '
', 'conditional' => array( 'option' => array( 'tag' => 'input', 'name' => 'post_format', 'type' => 'radio', ), 'option_value' => array( 'status' ), 'operand' => 'IS', ), ); $fields[45] = array( 'id' => 'post-format-video', 'type' => 'html', 'content' => '
' . __( '

Video post format

A single video. Please place the [wm_video] shortcode as the first thing in post content. The video description text can follow on next line.', 'mustang-lite' ) . '
', 'conditional' => array( 'option' => array( 'tag' => 'input', 'name' => 'post_format', 'type' => 'radio', ), 'option_value' => array( 'video' ), 'operand' => 'IS', ), ); /** * For more form fields options please check the PHP files inside * the "wm-amplifier/includes/metabox/fields/" folder. */ return $fields; } // /wm_post_formats_metafields /** * Post metabox metafields * * @version 1.1 * * @param array $fields Array of predefined metafields * * @return array Modified $fields array */ function wm_post_metafields( $fields = array() ) { //Helper variables $helper = array( 'sidebars' => ( ! function_exists( 'wm_helper_var' ) ) ? ( array( '' => __( 'Default', 'mustang-lite' ) ) ) : ( wm_helper_var( 'layouts', 'sidebars' ) ), ); if ( isset( $helper['sidebars']['sections'] ) ) { unset( $helper['sidebars']['sections'] ); } //"Settings" tab $fields[100] = array( 'type' => 'section-open', 'id' => 'page-options-section', 'title' => __( 'Settings', 'mustang-lite' ), ); $fields[120] = array( 'type' => 'checkbox', 'id' => 'disable-heading', 'label' => __( 'Disable main heading', 'mustang-lite' ), 'description' => __( 'Hide main heading section', 'mustang-lite' ), ); $fields[140] = array( 'type' => 'select', 'id' => 'sidebar', 'label' => __( 'Sidebar position', 'mustang-lite' ), 'description' => __( 'Select a sidebar position', 'mustang-lite' ), 'options' => $helper['sidebars'], ); $fields[1000] = array( 'type' => 'section-close', ); // /"Settings" tab /** * For more form fields options please check the PHP files inside * the "wm-amplifier/includes/metabox/fields/" folder. */ return $fields; } // /wm_post_metafields wma_add_meta_box( array( // Meta fields function callback (should return array of fields). // The function callback is used for to use a WordPress globals // available during the metabox rendering, such as $post. 'fields' => 'wm_post_metafields', // Meta box id, unique per meta box. 'id' => 'post-metabox', // Post types. 'pages' => array( 'post' ), // Meta box title. 'title' => __( 'Post options', 'mustang-lite' ), // Function callback of form fields displayed immediately after // visual editor on 1st tab. 'visual-wrapper-add' => 'wm_post_formats_metafields', ) ); /** * Page metabox */ /** * Page metabox metafields * * @version 1.7 * * @param array $fields Array of predefined metafields * * @return array Modified $fields array */ function wm_page_metafields( $fields = array() ) { //Helper variables global $post_id; $wm_layouts = ( ! function_exists( 'wm_helper_var' ) ) ? ( array( 'sidebars' => array(), 'website' => array() ) ) : ( wm_helper_var( 'layouts' ) ); $menus = get_terms( 'nav_menu', array( 'hide_empty' => true ) ); $helper = array( 'menus' => array( '' => __( 'Default', 'mustang-lite' ) ), 'sidebars' => $wm_layouts['sidebars'], 'website' => $wm_layouts['website'], ); if ( is_array( $menus ) && ! empty( $menus ) ) { foreach ( $menus as $item ) { if ( isset( $item->name ) && isset( $item->slug ) ) { $helper['menus'][ $item->slug ] = $item->name; } } } //"Settings" tab $fields[100] = array( 'type' => 'section-open', 'id' => 'page-options-section', 'title' => __( 'Settings', 'mustang-lite' ), 'page' => array( 'templates' => array( 'page-template/blank.php' ), 'operand' => 'IS_NOT' ), ); $fields[120] = array( 'type' => 'checkbox', 'id' => 'disable-heading', 'label' => __( 'Disable main heading', 'mustang-lite' ), 'description' => __( 'Hide main heading section', 'mustang-lite' ), ); $fields[140] = array( 'type' => 'select', 'id' => 'sidebar', 'label' => esc_html__( 'Page layout', 'mustang-lite' ), 'description' => esc_html__( 'Select a sidebar position or enable fullwidth sections.', 'mustang-lite' ) . '
' . esc_html__( 'Fullwidth sections page layout is suitable for use with page builders.', 'mustang-lite' ), 'options' => $helper['sidebars'], ); $fields[160] = array( 'type' => 'select', 'id' => 'layout', 'label' => __( 'Website layout', 'mustang-lite' ), 'description' => __( 'Select a website layout for this page', 'mustang-lite' ), 'options' => $helper['website'], ); $fields[180] = array( 'type' => 'select', 'id' => 'footer', 'label' => __( 'Footer layout', 'mustang-lite' ), 'description' => __( 'Select a footer layout', 'mustang-lite' ), 'options' => array( '' => __( 'Widgets and credits', 'mustang-lite' ), 'widgets' => __( 'Widgets only', 'mustang-lite' ), 'credits' => __( 'Credits only', 'mustang-lite' ), 'none' => __( 'No footer', 'mustang-lite' ), ), ); $fields[1000] = array( 'type' => 'section-close', ); // /"Settings" tab //"Slider" tab $fields[2000] = array( 'type' => 'section-open', 'id' => 'page-slider-section', 'title' => __( 'Slider', 'mustang-lite' ), 'page' => array( 'templates' => array( 'page-template/blank.php' ), 'operand' => 'IS_NOT' ), ); $fields[2020] = array( 'type' => 'html', 'content' => '
' . __( 'Please note that this is a special slider section setup.
This slider will be displayed above the website header area. For standard sliders please use the shortcodes directly in the page content.', 'mustang-lite' ) . '
', ); $fields[2040] = array( 'type' => 'select', 'id' => 'slider', 'label' => __( 'Set special slider', 'mustang-lite' ), 'description' => __( 'Select a slider type used as a special slider above the website header', 'mustang-lite' ), 'options' => array( '' => __( 'No special slider', 'mustang-lite' ), 'custom' => __( 'Custom slider (use shortcode)', 'mustang-lite' ), 'static' => __( 'Featured image', 'mustang-lite' ), ), ); $fields[2060] = array( 'type' => 'text', 'id' => 'slider-shortcode', 'label' => __( 'Slider shortcode', 'mustang-lite' ), 'description' => __( 'Set the custom slider shortcode', 'mustang-lite' ), 'conditional' => array( 'option' => array( 'tag' => 'select', 'name' => 'wm-slider', 'type' => '', ), 'option_value' => array( 'custom' ), 'operand' => 'IS', ), ); $fields[2080] = array( 'type' => 'select', 'id' => 'slider-static', 'label' => __( 'Image caption position', 'mustang-lite' ), 'description' => __( 'Featured image will be displayed in the special slider section.
Set the image caption (you can use shortcodes) and set the image caption position here.', 'mustang-lite' ) . '
' . __( 'Set featured image', 'mustang-lite' ) . '', 'options' => array( 'center' => __( 'Center', 'mustang-lite' ), 'left' => __( 'Left', 'mustang-lite' ), 'right' => __( 'Right', 'mustang-lite' ), ), 'conditional' => array( 'option' => array( 'tag' => 'select', 'name' => 'wm-slider', 'type' => '', ), 'option_value' => array( 'static' ), 'operand' => 'IS', ), ); $fields[3000] = array( 'type' => 'section-close', ); // /"Slider" tab //"Blog" tab $fields[4000] = array( 'type' => 'section-open', 'id' => 'page-blog-section', 'title' => __( 'Blog', 'mustang-lite' ), 'page' => array( 'templates' => array( 'home.php' ), 'operand' => 'IS' ), ); $fields[4020] = array( 'type' => 'slider', 'id' => 'blog-posts-count', 'label' => __( 'Number of posts', 'mustang-lite' ), 'description' => __( 'Sets the number of posts listed on this blog page only. Other archives will display posts according to WordPress settings.
Value of "-1" will display all posts. When you set the value of "0", WordPress settings are applied.', 'mustang-lite' ), 'default' => 0, 'min' => -1, 'max' => 25, 'step' => 1, 'zero' => true, ); //Categories multi field $category_fields = array(); $category_fields[] = array( 'type' => 'select', 'id' => 'category', 'label' => __( 'Category', 'mustang-lite' ), 'options' => wma_taxonomy_array(), ); $fields[4040] = array( 'type' => 'repeater', 'id' => 'blog-categories', 'label' => __( 'Posts categories', 'mustang-lite' ), 'description' => __( 'You can choose to display all posts or posts from a specific categories only. Press [+] button to add a category and select the category name from dropdown list.', 'mustang-lite' ), 'fields' => $category_fields, ); $fields[4060] = array( 'type' => 'radio', 'id' => 'blog-categories-action', 'label' => __( 'Categories action', 'mustang-lite' ), 'description' => __( 'Exclude or use the above categories?', 'mustang-lite' ), 'default' => 'category__in', 'options' => array( 'category__in' => __( 'Posts just from these categories', 'mustang-lite' ), 'category__not_in' => __( 'Exclude posts from these categories', 'mustang-lite' ), ), ); $fields[5000] = array( 'type' => 'section-close', ); // /"Blog" tab //"One page" tab if ( ! function_exists( 'wm_is_woocommerce' ) || ! ( function_exists( 'wm_is_woocommerce' ) && $post_id && $post_id == wc_get_page_id( 'shop' ) ) ) { $fields[6000] = array( 'type' => 'section-open', 'id' => 'page-one-section', 'title' => __( 'One page', 'mustang-lite' ), 'page' => array( 'templates' => array( 'page-template/one-page.php' ), 'operand' => 'IS' ), ); $fields[6020] = array( 'type' => 'html', 'content' => '
' . __( 'Use this page template to place most (or all) of your website content on a single page. Set the ID for each section of the page (apply on row shortcode) and use them in custom navigation as anchors. You can set a navigation for this page below. Once you click the navigation link, the page will scroll to the section of a specific anchor ID.', 'mustang-lite' ) . '
', ); $fields[6040] = array( 'type' => 'select', 'id' => 'navigation', 'label' => __( 'Anchor navigation', 'mustang-lite' ), 'description' => __( 'Set a special anchor navigation for this page', 'mustang-lite' ), 'options' => $helper['menus'], ); $fields[7000] = array( 'type' => 'section-close', ); } // /"One page" tab /** * For more form fields options please check the PHP files inside * the "wm-amplifier/includes/metabox/fields/" folder. */ return $fields; } // /wm_page_metafields wma_add_meta_box( array( // Meta fields function callback (should return array of fields). // The function callback is used for to use a WordPress globals // available during the metabox rendering, such as $post. 'fields' => 'wm_page_metafields', // Meta box id, unique per meta box. 'id' => 'page-metabox', // Post types. 'pages' => array( 'page' ), // Meta box title. 'title' => __( 'Page options', 'mustang-lite' ), ) ); /** * Staff metabox */ /** * Staff metabox fields alteration * * @param array $fields Array of predefined metafields * @param array $fonticons Array of icons names/classes * * @return array Modified $fields array */ function wm_staff_contact_fields( $fields = array(), $fonticons = array() ) { //Preparing output $fields = array(); if ( ! empty( $fonticons ) ) { $fields[] = array( 'type' => 'select', 'id' => 'icon', 'label' => __( 'Icon', 'mustang-lite' ), 'options' => $fonticons, ); } $fields[] = array( 'type' => 'text', 'id' => 'title', 'label' => __( 'Hover title', 'mustang-lite' ), ); $fields[] = array( 'type' => 'text', 'id' => 'link', 'label' => __( 'URL link', 'mustang-lite' ), ); //Output return $fields; } // /wm_staff_contact_fields add_filter( 'wmhook_wmamp_cp_metafields_wm_staff_contact_fields', 'wm_staff_contact_fields', 10, 2 ); /** * Projects metabox */ /** * Projects metabox fields alteration * * @version 1.6 * * @param array $fields Array of predefined metafields * * @return array Modified $fields array */ function wm_project_metafields( $fields = array() ) { //Preparing output $fields[1000]['title'] = __( 'Settings', 'mustang-lite' ); $fields[1010] = array( 'type' => 'select', 'id' => 'sidebar', 'label' => __( 'Page layout', 'mustang-lite' ), 'description' => esc_html__( 'Select a sidebar position or enable fullwidth sections.', 'mustang-lite' ) . '
' . esc_html__( 'Fullwidth sections page layout is suitable for use with page builders.', 'mustang-lite' ), 'options' => ( ! function_exists( 'wm_helper_var' ) ) ? ( array( '' => __( 'Default', 'mustang-lite' ) ) ) : ( wm_helper_var( 'layouts', 'sidebars' ) ), ); $fields[1015] = array( 'type' => 'text', 'id' => 'slider', 'label' => __( 'Custom preview slider', 'mustang-lite' ), 'description' => __( 'This slider will be displayed on projects list only, instead of featured image. Please enter the slider shortcode.', 'mustang-lite' ), ); $fields[1040]['options'][''] = ''; unset( $fields[1040]['options']['1OPTGROUP'] ); unset( $fields[1040]['options']['1/OPTGROUP'] ); //Output return $fields; } // /wm_project_metafields add_filter( 'wmhook_wmamp_cp_metafields_wm_projects', 'wm_project_metafields', 10 ); } // /wma_add_meta_box function check /** * SHORTCODES */ /** * Supported shortcodes version * * Use this to declare the plugin version that your theme supports. * It is possible that in future versions of the plugin there will be more * shortcodes added and your theme might not support them out of the box. * Setting this version number will make sure only the shortcodes included * with the specific plugin version will be available to your theme users. * * To use this function just uncomment the "add_filter" below * * @since 1.0 * @version 1.7 */ function wm_supported_shortcode_until_version() { // Output return '1.3'; } // /wm_supported_shortcode_until_version add_filter( 'wmhook_shortcode_supported_version', 'wm_supported_shortcode_until_version' ); /** * Posts shortcode default image size * * @version 1.1 */ function wm_shortcode_image_size() { //Requirements check if ( ! function_exists( 'wm_option' ) ) { return $size; } //Output return 'mobile-' . wm_option( 'skin-image-posts' ); } // /wm_shortcode_image_size add_filter( 'wmhook_shortcode_posts_image_size', 'wm_shortcode_image_size' ); /** * Slideshow shortcode default image size */ function wm_slideshow_image_size() { return 'content-width'; } // /wm_slideshow_image_size add_filter( 'wmhook_shortcode_slideshow_image_size', 'wm_slideshow_image_size' ); /** * Staff posts default image size */ function wm_staff_posts_image_size() { return 'admin-thumbnail'; } // /wm_staff_posts_image_size add_filter( 'wmhook_shortcode_posts_image_size_wm_staff', 'wm_staff_posts_image_size' ); /** * Content Module shortcode modifications */ /** * Content Module shortcode default layout * * Removing "morelink" and setting layout element for banner only. * * @param array $layouts * @param array $atts */ function wm_shortcode_content_module_layout( $layouts, $atts ) { //Preparing output $layouts['wm_modules'] = array( 'image', 'title', 'content' ); if ( false !== strpos( $atts['class'], 'banner' ) ) { $layouts['wm_modules'] = array( 'image', 'content' ); } //Output return $layouts; } // /wm_shortcode_content_module_layout add_filter( 'wmhook_shortcode_content_module_layouts', 'wm_shortcode_content_module_layout', 10, 2 ); /** * Content Module shortcode layout elements * * @param array $layout_elements * @param absint $post_id * @param array $helpers * @param array $atts */ function wm_shortcode_content_module_layout_elements( $layout_elements, $post_id, $helpers, $atts ) { //Preparing output if ( false !== strpos( $atts['class'], 'banner' ) ) { $content = wpautop( get_the_content() ); if ( $helpers['link'] ) { $content = '