Example #1
0
 function wm_assets_admin()
 {
     //Helper variables
     global $current_screen;
     $custom_styles = '';
     //Enqueue (only on specific admin pages)
     if (in_array($current_screen->base, array('edit', 'post'))) {
         //Styles
         wp_enqueue_style('wm-admin-styles', wm_get_stylesheet_directory_uri('css/admin.css'), false, esc_attr(trim(wp_get_theme()->get('Version'))), 'screen');
     }
 }
Example #2
0
 function wm_assets_admin()
 {
     //Helper variables
     global $current_screen;
     $custom_styles = '';
     //Enqueue (only on specific admin pages)
     if (in_array($current_screen->base, array('edit', 'post'))) {
         //Styles
         wp_enqueue_style('wm-admin-styles', wm_get_stylesheet_directory_uri('css/admin.css'), false, esc_attr(trim(wp_get_theme()->get('Version'))), 'screen');
         //Styles - inline
         $custom_styles .= '#post-' . get_option('page_on_front') . ' { background: #d7eef4; }';
         $custom_styles .= '#post-' . get_option('page_for_posts') . ' { background: #d7f4e3; }';
         wp_add_inline_style('wm-admin-styles', apply_filters('wmhook_esc_css', $custom_styles));
     }
 }
    if (is_numeric($banner_image)) {
        echo wp_get_attachment_image(absint($banner_image), 'modern_banner');
    } elseif (0 === strpos($banner_image, '<img ')) {
        echo $banner_image;
    } else {
        echo '<img src="' . esc_url($banner_image) . '" alt="' . the_title_attribute('echo=0') . '" title="' . the_title_attribute('echo=0') . '" />';
    }
} elseif (is_singular() && has_post_thumbnail() && empty($banner_image)) {
    //Post featured image
    the_post_thumbnail('modern_banner');
} elseif (is_attachment()) {
    //Attachment post image
    echo wp_get_attachment_image(get_the_ID(), 'modern_banner');
} else {
    //Fallback to Custom Header image
    $image_url = get_header_image() ? get_header_image() : wm_get_stylesheet_directory_uri('images/header.jpg');
    echo '<img src="' . esc_url($image_url) . '" width="' . esc_attr(get_custom_header()->width) . '" height="' . esc_attr(get_custom_header()->height) . '" alt="" />';
}
?>


		</figure>

	</div>

	<?php 
/**
 * Custom Header text
 *
 * Displays only on homepage.
 */
Example #4
0
 function wm_thumb($args = array())
 {
     //Helper variables
     $output = apply_filters('wmhook_wm_thumb_preprocess_output', '');
     //Requirements check
     if ($output) {
         return apply_filters('wmhook_wm_thumb_output', $output);
     }
     //Parse arguments
     $args = wp_parse_args($args, apply_filters('wmhook_wm_thumb_defaults', array('attr-img' => array(), 'attr-link' => array(), 'class' => 'image-container post-thumbnail', 'link' => '', 'addon' => '', 'placeholder' => false, 'post' => null, 'size' => 'medium', 'output' => '<div class="{class}"><a>{image}{addon}</a></div>')));
     //Getting parent post ID
     if (!$args['post']) {
         global $post;
         $args['post'] = $post;
     }
     $post_id = $args['post']->ID;
     //Getting image
     $attachment = has_post_thumbnail($post_id) ? get_post(get_post_thumbnail_id($post_id)) : '';
     $attachment_title[0] = isset($attachment->post_title) ? trim(strip_tags($attachment->post_title)) : '';
     $attachment_title[1] = isset($attachment->post_excerpt) ? trim(strip_tags($attachment->post_excerpt)) : '';
     $args['attr-img'] = wp_parse_args($args['attr-img'], array('title' => apply_filters('wmhook_wm_thumb_attachment_title', esc_attr(implode(' | ', array_filter((array) $attachment_title))))));
     $image = '';
     if ($attachment) {
         $image = get_the_post_thumbnail($post_id, $args['size'], $args['attr-img']);
     } elseif ($args['placeholder']) {
         $image = apply_filters('wmhook_wm_thumb_placeholder_image', '<img src="' . wm_get_stylesheet_directory_uri('assets/img/placeholder/' . $args['size'] . '.png') . '" alt="" />');
     }
     //Setting link
     if (trim($args['link'])) {
         if (is_array($args['attr-link'])) {
             $attr_link = '';
             foreach ($args['attr-link'] as $key => $value) {
                 $attr_link .= ' ' . $key . '="' . esc_attr($value) . '"';
             }
             $args['attr-link'] = $attr_link;
         }
         if (0 === strpos($args['link'], 'bigimage') && $attachment) {
             $image_size = trim(str_replace(array('bigimage', '|'), '', $args['link']));
             if (!$image_size) {
                 $image_size = 'full';
             }
             $args['link'] = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), $image_size);
             $args['link'] = $args['link'][0];
         }
         $args['link'] = '<a href="' . esc_url(trim($args['link'])) . '"' . $args['attr-link'] . '>';
     }
     //Preparing output
     if ($image) {
         $replacements = apply_filters('wmhook_wm_thumb_replacements', array('{addon}' => trim($args['addon']), '<a>' => $args['link'] ? $args['link'] : '', '</a>' => $args['link'] ? '</a>' : '', '{class}' => esc_attr(trim($args['class'])), '{image}' => $image));
         $output = strtr($args['output'], $replacements);
     }
     //Output
     return apply_filters('wmhook_wm_thumb_output', $output);
 }
Example #5
0
 function wm_customizer_preview_enqueue_assets()
 {
     //Scripts
     wp_enqueue_script('wm-customizer-preview', wm_get_stylesheet_directory_uri('js/customizer-preview.js'), array('customize-preview'), esc_attr(trim(wp_get_theme()->get('Version'))), true);
 }
Example #6
0
/**
 * Modifying page builder parameters
 *
 * @version  1.6
 */
function wm_modify_shortcodes_definitions($definitions)
{
    // Processing
    // Beaver Builder
    // Content Module
    unset($definitions['content_module']['bb_plugin']['form']['general']['sections']['multiple']['fields']['filter']);
    unset($definitions['content_module']['bb_plugin']['form']['general']['sections']['multiple']['fields']['pagination']);
    unset($definitions['content_module']['bb_plugin']['form']['description']);
    unset($definitions['content_module']['bb_plugin']['form']['others']['sections']['general']['fields']['no_margin']);
    unset($definitions['content_module']['bb_plugin']['form']['others']['sections']['general']['fields']['image_size']);
    unset($definitions['content_module']['bb_plugin']['form']['others']['sections']['general']['fields']['layout']);
    // Posts
    unset($definitions['posts']['bb_plugin']['form']['description']);
    unset($definitions['posts']['bb_plugin']['form']['others']['sections']['general']['fields']['filter_layout']);
    unset($definitions['posts']['bb_plugin']['form']['others']['sections']['general']['fields']['related']);
    unset($definitions['posts']['bb_plugin']['form']['others']['sections']['general']['fields']['image_size']);
    // Adding "layout" parameter
    $definitions['posts']['bb_plugin']['output'] = str_replace('[PREFIX_posts', '[PREFIX_posts{{layout}}', (string) $definitions['posts']['bb_plugin']['output']);
    $definitions['posts']['bb_plugin']['params'] = array_merge(array('layout'), (array) $definitions['posts']['bb_plugin']['params']);
    $definitions['posts']['bb_plugin']['form']['others']['sections']['general']['fields']['layout'] = array('type' => 'select', 'label' => esc_html__('Layout', 'mustang'), 'options' => array('' => esc_html__('Default layout', 'mustang'), 'simple' => esc_html__('Simple posts or projects layout', 'mustang')), 'preview' => array('type' => 'refresh'));
    // Testimonials
    unset($definitions['testimonials']['bb_plugin']['form']['description']);
    unset($definitions['testimonials']['bb_plugin']['form']['others']['sections']['general']['fields']['no_margin']);
    // Visual Composer
    if (function_exists('wma_is_active_vc') && wma_is_active_vc()) {
        foreach ($definitions as $key => $atts) {
            if (!in_array($key, array('vc_row', 'vc_row_inner')) && isset($atts['vc_plugin'])) {
                $definitions[$key]['vc_plugin']['category'] = esc_html__('Theme Modules', 'mustang');
                $definitions[$key]['vc_plugin']['icon'] = wm_get_stylesheet_directory_uri('assets/img/webman-32x32.png');
            }
        }
        // Posts
        $definitions['posts']['vc_plugin']['params'][30]['value'] = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9);
        $definitions['posts']['vc_plugin']['params'][145] = array('heading' => __('Output layout', 'mustang'), 'description' => __('Set optional output layout name. You can use <code>simple</code> with <em>Posts</em> and <em>Projects</em> posts.', 'mustang'), 'type' => 'textfield', 'param_name' => 'layout', 'value' => '', 'holder' => 'hidden', 'class' => '', 'group' => __('Layout', 'mustang'));
        // Row
        $definitions['vc_row']['vc_plugin']['params'][5] = array('heading' => __('Remove section inner container', 'mustang'), 'description' => __('This is only relevant when using "Fullwidth sections" page layout.', 'mustang'), 'type' => 'checkbox', 'param_name' => 'disable_container', 'value' => '', 'value' => array(__('Remove the inner Section container to make the content fill the whole section without any paddings.', 'mustang') => 1), 'holder' => 'hidden', 'class' => '');
        $definitions['vc_row']['vc_plugin']['params'][90] = array('heading' => __('Section background video URL', 'mustang'), 'description' => __('Set optional section background video URL. Video will be played automatically in a loop.', 'mustang'), 'type' => 'textfield', 'param_name' => 'video_url', 'value' => '', 'holder' => 'hidden', 'class' => '', 'group' => __('Styling', 'mustang'));
        // Column
        $definitions['vc_column']['vc_plugin']['params'][5] = array('heading' => __('Background image', 'mustang'), 'description' => __('The image will cover the column background', 'mustang'), 'type' => 'attach_image', 'param_name' => 'bg_image', 'value' => '', 'holder' => 'hidden', 'class' => '');
        // Slideshow
        $definitions['slideshow']['vc_plugin']['params'][20]['value'] = array(__('Just Next/Prev button', 'mustang') => '', __('Next/Prev + Pagination', 'mustang') => 'pagination');
        // bbPress
        if (class_exists('bbPress')) {
            //Forum index
            $definitions['bbp-forum-index'] = array('vc_plugin' => array('name' => __('Forums Index', 'mustang'), 'base' => 'bbp-forum-index', 'class' => 'wm-shortcode-vc-bbp-forum-index', 'category' => __('Forum', 'mustang'), 'show_settings_on_create' => false, 'params' => array(10 => array('heading' => '<a href="http://codex.bbpress.org/shortcodes/" target="_blank"><strong>' . __('bbPress Shortcode', 'mustang') . '</strong></a>', 'description' => __('This will display your entire forum index. No parameters to be set.', 'mustang'), 'type' => 'wm_html', 'param_name' => 'forums', 'value' => '', 'holder' => 'hidden', 'class' => ''))));
        }
    }
    // Output
    return $definitions;
}
Example #7
0
 function wm_credits()
 {
     //Helper variables
     $output = $copy_text = '';
     $widget_area_atts = apply_filters('wmhook_wm_credits_widget_area_atts', array('class' => 'widget-area clearfix', 'max_widgets_count' => 3, 'sidebar' => 'credits'));
     if (function_exists('wma_sidebar')) {
         $copy_text = wma_sidebar($widget_area_atts);
     }
     if (empty($copy_text)) {
         $copy_text = '&copy; ' . get_bloginfo('name');
     }
     //Preparing output
     $replacements = array('(C)' => '&copy;', 'YEAR' => date('Y'));
     $copy_text = strtr($copy_text, $replacements);
     $output .= "\r\n\r\n" . '<div class="credits clearfix">';
     $output .= wm_option('skin-footer-shadow') ? '<img src="' . wm_get_stylesheet_directory_uri('assets/img/shadow-bottom.png') . '" alt="" class="footer-shadow" />' : '';
     $output .= apply_filters('wmhook_section_inner_wrappers', '');
     $output .= $copy_text;
     $output .= apply_filters('wmhook_section_inner_wrappers_close', '');
     $output .= "\r\n" . '</div>' . "\r\n";
     //Output
     return apply_filters('wmhook_wm_credits_output', $output);
 }
Example #8
0
 function wm_bb_assets()
 {
     // Processing
     if (wm_bb_is_active()) {
         // Styles
         wp_enqueue_style('mustang-bb', wm_get_stylesheet_directory_uri('assets/css/beaver-builder.css'), false, esc_attr(trim(WM_SCRIPTS_VERSION)), 'screen');
     }
     if (class_exists('FLBuilderModel') && FLBuilderModel::is_builder_active()) {
         // Styles
         wp_enqueue_style('mustang-bb-editor', wm_get_stylesheet_directory_uri('assets/css/beaver-builder-editor.css'), false, esc_attr(trim(WM_SCRIPTS_VERSION)), 'screen');
     }
 }