예제 #1
0
 /**
  * Check cache is disabled or builder is active or in admin
  * 
  * return boolean
  */
 public static function is_cache_activate()
 {
     $active = is_user_logged_in() && current_user_can('manage_options') || themify_get('setting-page_builder_cache') || is_admin() ? true : (class_exists('Themify_Builder') ? Themify_Builder::is_front_builder_activate() : FALSE);
     return apply_filters('themify_builder_is_cache_active', $active);
 }
예제 #2
0
 /**
  * Add class and data attribute to portfolio section
  * @param sting $link
  * @return string
  */
 function porto_expand_link($link)
 {
     global $post, $themify;
     if ('yes' == $themify->portfolio_expander && 'portfolio' == get_post_type() && themify_get('external_link') == '' && themify_get('lightbox_link') == '') {
         $link .= '" class="porto-expand-js" data-post-id="' . $post->ID . '" data-post-type="' . get_post_type();
     }
     return $link;
 }
 } else {
     $num_posts = "showposts=5&";
 }
 if (themify_check('setting-header_slider_display') && themify_get('setting-header_slider_display') == "images") {
     $options = array("one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten");
     foreach ($options as $option) {
         if (themify_check('setting-header_slider_images_' . $option . '_image')) {
             echo "<li>";
             if (themify_check('setting-header_slider_images_' . $option . '_link')) {
                 $title = themify_check('setting-header_slider_images_' . $option . '_title') ? '<h3 class="feature-post-title">' . themify_get('setting-header_slider_images_' . $option . '_title') . '</h3>' : '';
                 $link = themify_get('setting-header_slider_images_' . $option . '_link');
                 $image = themify_get('setting-header_slider_images_' . $option . '_image');
                 themify_image("src=" . $image . "&setting=header_slider&ignore=true&w=145&h=120&before=<a href='" . urlencode($link) . "' title='" . urlencode($link) . "'>&after=</a>&alt=" . urlencode($link) . "&class=feature-img");
                 echo $title;
             } else {
                 $image = themify_get('setting-header_slider_images_' . $option . '_image');
                 themify_image("src=" . $image . "&setting=header_slider&ignore=true&w=145&h=120&alt=" . $image . "&class=feature-img");
                 echo $title;
             }
             echo "</li>";
         }
     }
 } else {
     query_posts($num_posts . $cat);
     if (have_posts()) {
         while (have_posts()) {
             the_post();
             ?>
             
                 	<li>
                    		<?php 
 /**
  * Main shortcode rendering
  * @param array $atts
  * @param $post_type
  * @return string|void
  */
 function shortcode($atts = array(), $post_type)
 {
     extract($atts);
     // Pagination
     global $paged;
     $paged = get_query_var('paged') ? get_query_var('paged') : 1;
     // Parameters to get posts
     $args = array('post_type' => $post_type, 'posts_per_page' => $limit, 'order' => $order, 'orderby' => $orderby, 'suppress_filters' => false, 'paged' => $paged);
     // Category parameters
     $args['tax_query'] = $this->parse_category_args($category, $post_type);
     // Defines layout type
     $cpt_layout_class = $this->post_type . '-multiple clearfix type-multiple';
     $multiple = true;
     // Single post type or many single post types
     if ('' != $id) {
         if (strpos($id, ',')) {
             $ids = explode(',', str_replace(' ', '', $id));
             foreach ($ids as $string_id) {
                 $int_ids[] = intval($string_id);
             }
             $args['post__in'] = $int_ids;
             $args['orderby'] = 'post__in';
         } else {
             $args['p'] = intval($id);
             $cpt_layout_class = $this->post_type . '-single';
             $multiple = false;
         }
     }
     // Get posts according to parameters
     $portfolio_query = new WP_Query();
     $posts = $portfolio_query->query(apply_filters('themify_' . $post_type . '_shortcode_args', $args));
     // Grid Style
     if ('' == $style) {
         $style = themify_check('setting-default_portfolio_index_post_layout') ? themify_get('setting-default_portfolio_index_post_layout') : 'grid4';
     }
     if (is_singular('portfolio')) {
         if ('' == $image_w) {
             $image_w = themify_check('setting-default_portfolio_single_image_post_width') ? themify_get('setting-default_portfolio_single_image_post_width') : '670';
         }
         if ('' == $image_h) {
             $image_h = themify_check('setting-default_portfolio_single_image_post_height') ? themify_get('setting-default_portfolio_single_image_post_height') : '0';
         }
         if ('' == $post_date) {
             $post_date = themify_check('setting-default_portfolio_single_post_date') ? themify_get('setting-default_portfolio_index_post_date') : 'yes';
         }
         if ('' == $title) {
             $title = themify_check('setting-default_portfolio_single_title') ? themify_get('setting-default_portfolio_single_title') : 'yes';
         }
         if ('' == $unlink_title) {
             $unlink_title = themify_check('setting-default_portfolio_single_unlink_post_title') ? themify_get('setting-default_portfolio_single_unlink_post_title') : 'no';
         }
         if ('' == $post_meta) {
             $post_meta = themify_check('setting-default_portfolio_single_meta') ? themify_get('setting-default_portfolio_single_meta') : 'yes';
         }
     } else {
         if ('' == $image_w) {
             $image_w = themify_check('setting-default_portfolio_index_image_post_width') ? themify_get('setting-default_portfolio_index_image_post_width') : '221';
         }
         if ('' == $image_h) {
             $image_h = themify_check('setting-default_portfolio_index_image_post_height') ? themify_get('setting-default_portfolio_index_image_post_height') : '221';
         }
         if ('' == $title) {
             $title = themify_check('setting-default_portfolio_index_title') ? themify_get('setting-default_portfolio_index_title') : 'yes';
         }
         if ('' == $unlink_title) {
             $unlink_title = themify_check('setting-default_portfolio_index_unlink_post_title') ? themify_get('setting-default_portfolio_index_unlink_post_title') : 'no';
         }
         // Reverse logic
         if ('' == $post_date) {
             $post_date = themify_check('setting-default_portfolio_index_post_date') ? 'no' == themify_get('setting-default_portfolio_index_post_date') ? 'yes' : 'no' : 'no';
         }
         if ('' == $post_meta) {
             $post_meta = themify_check('setting-default_portfolio_index_post_meta_category') ? 'no' == themify_get('setting-default_portfolio_index_post_meta_category') ? 'yes' : 'no' : 'no';
         }
     }
     // Collect markup to be returned
     $out = '';
     if ($posts) {
         global $themify;
         $themify_save = clone $themify;
         // save a copy
         // override $themify object
         $themify->hide_title = 'yes' == $title ? 'no' : 'yes';
         $themify->unlink_title = '' == $unlink_title || 'no' == $unlink_title ? 'no' : 'yes';
         $themify->hide_image = 'yes' == $image ? 'no' : 'yes';
         $themify->hide_meta = 'yes' == $post_meta ? 'no' : 'yes';
         $themify->hide_date = 'yes' == $post_date ? 'no' : 'yes';
         if (!$multiple) {
             if ('' == $image_w || get_post_meta($args['p'], 'image_width', true)) {
                 $themify->width = get_post_meta($args['p'], 'image_width', true);
             }
             if ('' == $image_h || get_post_meta($args['p'], 'image_height', true)) {
                 $themify->height = get_post_meta($args['p'], 'image_height', true);
             }
         } else {
             $themify->width = $image_w;
             $themify->height = $image_h;
         }
         $themify->use_original_dimensions = 'yes' == $use_original_dimensions ? 'yes' : 'no';
         $themify->display_content = $display;
         $themify->more_link = $more_link;
         $themify->more_text = $more_text;
         $themify->post_layout = $style;
         $themify->portfolio_instance = $this->instance;
         $out .= '<div class="loops-wrapper shortcode ' . $post_type . ' ' . $style . ' ' . $cpt_layout_class . '">';
         $out .= themify_get_shortcode_template($posts, 'includes/loop-portfolio', 'index');
         $out .= $this->section_link($more_link, $more_text, $post_type);
         $out .= '</div>';
         $themify = clone $themify_save;
         // revert to original $themify state
     }
     return $out;
 }
예제 #5
0
    /**
     * Module to specify additional characters subsets
     * @param array Themify data
     * @return string Module markup
     * @since 1.3.9
     */
    function themify_webfonts_subsets($data = array())
    {
        $data = themify_get_data();
        $key = 'setting-webfonts_subsets';
        $subsets = themify_get($key);
        return '<p>
					<span class="label">' . __('Additional subsets', 'themify') . '</span> <input type="text" class="width10" name="' . $key . '" value="' . $subsets . '" /> <br />
					<span class="pushlabel">
					<a href="#" class="refresh-webfonts button">' . __('Refresh list', 'themify') . '</a>
					<br/><small>' . __('Enter the additional character subsets you need to use from Google WebFonts separated by commas. Example: latin-ext,cyrillic', 'themify') . '</small></span>
				</p>';
    }
예제 #6
0
} else {
    $width = $post_image_width;
    $height = $post_image_height;
}
if (get_query_var('paged')) {
    $paged = get_query_var('paged');
} elseif (get_query_var('page')) {
    $paged = get_query_var('page');
} else {
    $paged = 1;
}
if ($post_query_category != "") {
    ?>
		
			<?php 
    if (themify_get('section_categories') != 'yes') {
        ?>
			
				<?php 
        $wp_query->query('cat=' . $post_query_category . '&posts_per_page=' . $posts_per_page . '&paged=' . $paged);
        ?>
				
					<?php 
        if (have_posts()) {
            ?>
						
						<!-- loops-wrapper -->
						<div class="loops-wrapper <?php 
            echo $post_layout;
            ?>
">
            ?>
			
					<?php 
            the_excerpt();
            ?>
			
				<?php 
        } elseif ($display_testimonial == 'none') {
            ?>
			
				<?php 
        } else {
            ?>

					<?php 
            the_content(themify_check('setting-default_more_text') ? themify_get('setting-default_more_text') : __('More &rarr;', 'themify'));
            ?>
				
				<?php 
        }
        //display content
        ?>
				
				<?php 
        edit_post_link(__('Edit', 'themify'), '[', ']');
        ?>

				<p class="testimonial-author">
					<?php 
        echo $BuilderTestimonial->author_name($post, 'yes');
        ?>
예제 #8
0
/**
 * Add Builder to all themes using the themify_theme_config_setup filter.
 * @param $themify_theme_config
 * @return mixed
 * @since 1.4.2
 */
function themify_framework_theme_config_add_builder($themify_theme_config)
{
    $themify_theme_config['panel']['settings']['tab']['page_builder'] = array('title' => __('Themify Builder', 'themify'), 'id' => 'themify-builder', 'custom-module' => array(array('title' => __('Enable/Disable Themify Builder', 'themify'), 'function' => 'themify_manage_builder_active')));
    if ('disable' != apply_filters('themify_enable_builder', themify_get('setting-page_builder_is_active'))) {
        $themify_theme_config['panel']['settings']['tab']['page_builder']['custom-module'][] = array('title' => __('Builder Options', 'themify'), 'function' => 'themify_manage_builder');
    }
    return $themify_theme_config;
}
예제 #9
0
 * Creates numbered pagination or displays button for infinite scroll based on user selection
 * @since 1.0.0
 */
if ('infinite' == themify_get('setting-more_posts') || '' == themify_get('setting-more_posts')) {
    global $wp_query, $themify;
    $total_pages = $wp_query->max_num_pages;
    $current_page = get_query_var('paged') ? get_query_var('paged') : 1;
    if ($total_pages > $current_page) {
        if ($themify->query_category != '') {
            //If it's a Query Category page, set the number of total pages
            echo '<script type="text/javascript">var qp_max_pages = ' . $total_pages . '</script>';
        }
        echo '<p id="load-more"><a href="' . next_posts($total_pages, false) . '">' . __('Load More', 'themify') . '</a></p>';
    }
} else {
    if ('numbered' == themify_get('setting-entries_nav') || '' == themify_get('setting-entries_nav')) {
        themify_pagenav();
    } else {
        ?>
		<div class="post-nav">
			<span class="prev"><?php 
        next_posts_link(__('&laquo; Older Entries', 'themify'));
        ?>
</span>
			<span class="next"><?php 
        previous_posts_link(__('Newer Entries &raquo;', 'themify'));
        ?>
</span>
		</div>
	<?php 
    }
/**
 * Create a slider with posts retrieved through get_posts
 * @param Object $atts
 * @param String $content
 * @return String
 */
function themify_shortcode_post_slider($atts, $content = null)
{
    wp_enqueue_script('themify-carousel-js');
    extract(shortcode_atts(array('visible' => '1', 'scroll' => '1', 'auto' => '0', 'pause_hover' => 'no', 'wrap' => 'yes', 'excerpt_length' => '20', 'speed' => 'normal', 'slider_nav' => 'yes', 'pager' => 'yes', 'limit' => '5', 'offset' => '0', 'category' => '', 'image' => 'yes', 'image_w' => '240px', 'image_h' => '180px', 'more_text' => __('More...', 'themify'), 'title' => 'yes', 'display' => 'none', 'post_meta' => 'no', 'post_date' => 'no', 'width' => '', 'height' => '', 'class' => '', 'unlink_title' => 'no', 'unlink_image' => 'no', 'image_size' => 'medium', 'post_type' => 'post', 'taxonomy' => 'category', 'order' => 'DESC', 'orderby' => 'date', 'effect' => 'scroll'), $atts, 'themify_post_slider'));
    $wrapvar = 'false';
    if ('yes' == $wrap) {
        $wrapvar = 'true';
    }
    if ('0' == $auto) {
        $play = 'false';
    } else {
        $play = 'true';
    }
    switch ($speed) {
        case 'fast':
            $speed = '.5';
            break;
        case 'normal':
            $speed = '1';
            break;
        case 'slow':
            $speed = '4';
            break;
    }
    $pause_hover = $pause_hover == 'yes' ? 'true' : 'false';
    $numsldr = rand(0, 10000);
    $postsliderstr = '';
    global $post;
    $query_args = array('numberposts' => $limit, 'offset' => $offset, 'post_type' => $post_type, 'order' => $order, 'orderby' => $orderby, 'suppress_filters' => false, 'post__not_in' => array(get_the_ID()));
    if ('' != $category) {
        $tax_query_terms = explode(',', $category);
        if (preg_match('#[a-z]#', $category)) {
            $query_args['tax_query'] = array(array('taxonomy' => $taxonomy, 'field' => 'slug', 'terms' => $tax_query_terms));
        } else {
            $exclude = array_filter($tax_query_terms, 'themify_is_negative_number');
            $query_args['tax_query'] = array('relation' => 'AND', array('taxonomy' => $taxonomy, 'field' => 'id', 'terms' => array_filter($tax_query_terms, 'themify_is_positive_number')), array('taxonomy' => $taxonomy, 'field' => 'id', 'terms' => array_map('themify_make_absolute_number', $exclude), 'operator' => 'NOT IN'));
        }
    }
    $posts = get_posts($query_args);
    $class .= ' effect-' . $effect;
    if ($posts) {
        $postsliderstr = '<!-- shortcode post_slider --> <div id="post-slider-' . esc_attr($numsldr) . '" style="width: ' . esc_attr($width) . '; height: ' . esc_attr($height) . ';" class="shortcode clearfix post-slider ' . $class . '">
		<ul class="slides">';
        foreach ($posts as $post) {
            setup_postdata($post);
            global $more;
            $more = 0;
            $post_class = '';
            foreach (get_post_class() as $postclass) {
                $post_class .= " " . $postclass;
            }
            //get_post_class() as $postclass
            $postsliderstr .= '<li><div  class="slide-wrap ' . esc_attr($post_class) . '">';
            if ('yes' == $image) {
                $video_url = themify_get('video_url');
                if ('' != $video_url) {
                    $postsliderstr .= '<div class="post-video">';
                    global $wp_embed;
                    $postsliderstr .= $wp_embed->run_shortcode('[embed]' . $video_url . '[/embed]');
                    $postsliderstr .= '</div>';
                } else {
                    if ('no' == $unlink_image) {
                        $postsliderstr .= themify_get_image(array('image_size=' => $image_size, 'ignore' => true, 'w' => $image_w, 'h' => $image_h, 'alt' => get_the_title(), 'before' => '<p class="post-image"><a href="' . themify_get_featured_image_link() . '">', 'after' => '</a></p>'));
                    } else {
                        $postsliderstr .= themify_get_image(array('image_size' => $image_size, 'ignore' => true, 'w' => $image_w, 'h' => $image_h, 'alt' => get_the_title(), 'before' => '<p class="post-image">', 'after' => '</p>'));
                    }
                }
            }
            //'yes' == $image
            if ('yes' == $title) {
                if ('no' == $unlink_title) {
                    $postsliderstr .= '<h3 class="post-title"><a href="' . themify_get_featured_image_link() . '">' . get_the_title() . '</a></h3>';
                } else {
                    $postsliderstr .= '<h3 class="post-title">' . get_the_title() . '</h3>';
                }
            }
            //$title == "yes"
            if ($post_date == "yes") {
                $postsliderstr .= '<p class="post-date">' . get_the_date() . '</p>';
            }
            //$post_date == "yes"
            if ('yes' == $post_meta) {
                $postsliderstr .= '<p class="post-meta">
					<span class="post-author">' . get_the_author() . '</span>
					<span class="post-category">' . get_the_category_list(', ') . '</span>';
                if (comments_open()) {
                    ob_start();
                    comments_popup_link('0', '1', '%', 'comments-link', '');
                    $write_comments = ob_get_contents();
                    ob_clean();
                } else {
                    $write_comments = '';
                }
                $postsliderstr .= '<span class="post-comment">' . $write_comments . '</span>';
                if (has_tag()) {
                    $postsliderstr .= '<span class="post-tag">' . get_the_tag_list('', ', ') . '</span>';
                }
                $postsliderstr .= '</p>';
            }
            //$post_meta == "yes"
            if ('content' == $display) {
                $postsliderstr .= '<div class="post-content">' . wp_kses_post(themify_get_content($more_text)) . '</div></div></li>
';
            }
            //$display == "content"
            if ('excerpt' == $display) {
                $postsliderstr .= '<div class="post-content">' . wp_kses_post(themify_excerpt($excerpt_length)) . '</div></div></li>
';
            }
            //$display == "excerpt"
        }
        $postsliderstr .= '</ul>';
        $postsliderstr .= '</div>
		<script type="text/javascript">
		(function($){
			$(window).load(function() {
				var $slider_slides = $("#post-slider-' . $numsldr . ' .slides");
				$("#post-slider-' . $numsldr . ' .slides").carouFredSel({
			responsive: true,';
        if ('yes' == $slider_nav) {
            $postsliderstr .= '
				prev: "#post-slider-' . $numsldr . ' .carousel-prev",
				next: "#post-slider-' . $numsldr . ' .carousel-next",';
        }
        if ('yes' == $pager) {
            $postsliderstr .= '
				pagination: "#post-slider-' . $numsldr . ' .carousel-pager",';
        }
        $postsliderstr .= '
			circular: ' . $wrapvar . ',
			infinite: ' . $wrapvar . ',
			auto: {
				play : ' . $play . ',
				timeoutDuration: ' . $auto . '*1000,
				duration: ' . $speed . '*1000,
				pauseOnHover: ' . $pause_hover . '
			},
			swipe: true,
			scroll: {
				items: ' . $scroll . ',
				duration: ' . $speed . '*1000,
				fx: "' . $effect . '"
			},
			items: {
				visible: {
					min: 1,
					max: ' . $visible . '
				},
				width: 120
			},
			onCreate : function (){
				jQuery(".post-slider").css( {
					"height": "auto",
					"visibility" : "visible"
				});
			}
		});
			
				var tscpsDidResize = false;
				$(window).on("resize", function() {
					tscpsDidResize = true;
	});
				setInterval(function() {
					if ( tscpsDidResize ) {
						tscpsDidResize = false;

						$(".slides").each(function(){
							var heights = [],
								newHeight,
								$self = $(this);
							$self.find("li").each( function() {
								heights.push( $(this).outerHeight() );
							});
							newHeight = Math.max.apply( Math, heights );
							$self.outerHeight( newHeight );
							$(".caroufredsel_wrapper").outerHeight( newHeight );
						});

					}
				}, 500);
			});
		})(jQuery);
	</script> <!-- /shortcode post_slider -->';
        wp_reset_postdata();
    }
    //$posts
    return $postsliderstr;
}
 function get_bggallery_order()
 {
     $sc_order = false;
     if (themify_is_woocommerce_active() && is_shop()) {
         $gallery_raw = get_post_meta(get_option('woocommerce_shop_page_id'), 'background_gallery', true);
     } else {
         $gallery_raw = themify_get('background_gallery');
     }
     if (strpos($gallery_raw, 'orderby') !== false) {
         $sc_order = preg_replace('#\\[gallery(.*)orderby="([a-zA-Z0-9]*)"(.*)\\]#i', '$2', $gallery_raw);
     }
     return $sc_order ? $sc_order : 'post__in';
 }
예제 #12
0
function themify_img_settings($data = array())
{
    /*** Img.php Crop Option Array ***/
    $options = array(array("value" => "c", "name" => __('Center', 'themify')), array("value" => "t", "name" => __('Top', 'themify')), array("value" => "tr", "name" => __('Top Right', 'themify')), array("value" => "tl", "name" => __('Top Left', 'themify')), array("value" => "b", "name" => __('Bottom', 'themify')), array("value" => "br", "name" => __('Bottom Right', 'themify')), array("value" => "bl", "name" => __('Bottom Left', 'themify')), array("value" => "l", "name" => __('Left', 'themify')), array("value" => "r", "name" => __('Right', 'themify')));
    $options_vertical = array(array('name' => '', 'value' => ''), array('name' => __('Yes', 'themify'), 'value' => 'yes'), array('name' => __('No', 'themify'), 'value' => 'no'));
    $feature_sizes = array(array('value' => 'blank', 'name' => ''), array('value' => 'thumbnail', 'name' => __('Thumbnail', 'themify')), array('value' => 'medium', 'name' => __('Medium', 'themify')), array('value' => 'large', 'name' => __('Large', 'themify')), array('value' => 'full', 'name' => __('Original Image', 'themify')));
    if (themify_check('setting-img_settings_use')) {
        $checked_use = "checked='checked'";
    }
    if (themify_check('setting-img_settings_legacy')) {
        $checked_legacy = "checked='checked'";
    }
    $output = '<div class="module">
				<div class="label">img.php</div> 
				<div class="row">
					<input type="checkbox" class="disable_img_php" name="setting-img_settings_use" ' . $checked_use . '/> ' . __('Disable img.php globally', 'themify') . '<br/>
					<small>' . __('(WordPress Featured Image or original images will be used)', 'themify') . '</small>
					<br/>
				</div>
			<!-- BEGIN Show if img.php is enabled -->
			<div class="show_if_enabled_img_php">
				<div class="label">' . __('Image Quality', 'themify') . '</div> 
				<div class="row">
					<input class="width2" type="text" name="setting-img_settings_quality" value="' . themify_get('setting-img_settings_quality') . '"> <small>' . __('max 100 (higher = better quality, but bigger file size)', 'themify') . '</small>
				</div>

				<div class="label">' . __('Cropping Alignment', 'themify') . '</div> 
				<div class="row">
					
					<select name="setting-img_settings_crop_option"><option></option>';
    foreach ($options as $option) {
        if ($option['value'] == themify_get('setting-img_settings_crop_option')) {
            $output .= '<option value="' . $option['value'] . '" selected="selected">' . $option['name'] . '</option>';
        } else {
            $output .= '<option value="' . $option['value'] . '">' . $option['name'] . '</option>';
        }
    }
    $output .= '</select></div>
				 <div class="label">' . __('Vertical Cropping', 'themify') . '</div> 
				<div class="row">
					
					<select name="setting-img_settings_vertical_crop_option">';
    foreach ($options_vertical as $option_vertical) {
        if ($option_vertical['value'] == themify_get('setting-img_settings_vertical_crop_option')) {
            $output .= '<option value="' . $option_vertical['value'] . '" selected="selected">' . $option_vertical['name'] . '</option>';
        } else {
            $output .= '<option value="' . $option_vertical['value'] . '">' . $option_vertical['name'] . '</option>';
        }
    }
    $output .= '</select> <small>' . __('(Select \'no\' to disable vertical cropping globally)', 'themify') . '</small></div>
		</div>
		<!-- END Show if img.php is enabled -->
				 </div>';
    return $output;
}
예제 #13
0
    /**
     * Add transition effect
     * FlyIn/FadeIn/disabled
     * @return string
     */
    function themify_transition_effect()
    {
        $data = themify_get_data();
        $prefix = 'setting-transition_effect_';
        $fadein_checked = '';
        $mobile_checked = '';
        $disabled_checked = '';
        $mobile_options = array(array('name' => __('Off', 'themify'), 'value' => 'off'), array('name' => __('On', 'themify'), 'value' => 'on'));
        if (themify_check($prefix . 'fadein')) {
            $fadein_checked = "checked='checked'";
        }
        if (themify_check($prefix . 'mobile_exclude')) {
            $mobile_checked = "checked='checked'";
        }
        if (themify_check($prefix . 'all_disabled')) {
            $disabled_checked = "checked='checked'";
        }
        $output = '<p>
						<span class="label" style="width:400px;">' . __('Turn off fly-in animation on mobile/tablet for better performance', 'themify') . '</span> 
						<select name="' . $prefix . 'mobile_exclude">';
        foreach ($mobile_options as $mobile_option) {
            $output .= '<option ' . selected(themify_get($prefix . 'mobile_exclude'), $mobile_option['value'], false) . ' value="' . $mobile_option['value'] . '">' . $mobile_option['name'] . '</option>';
        }
        $output .= '	</select>
					</p>';
        $output .= '<p><label for="' . $prefix . 'fadein"><input type="checkbox" id="' . $prefix . 'fadein" name="' . $prefix . 'fadein" ' . $fadein_checked . '/> ' . __('Use fade-in transition effect instead of fly-in', 'themify') . '</label></p>';
        $output .= '<p><label for="' . $prefix . 'all_disabled"><input type="checkbox" id="' . $prefix . 'all_disabled" name="' . $prefix . 'all_disabled" ' . $disabled_checked . '/> ' . __('Disable all transition effect', 'themify') . '</label></p>';
        return $output;
    }
예제 #14
0
    function widget($args, $instance)
    {
        extract($args);
        /* User-selected settings. */
        $title = apply_filters('widget_title', $instance['title']);
        /* Before widget (defined by themes). */
        echo $before_widget;
        /* Title of widget (before and after defined by themes). */
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        $data = themify_get_data();
        $pre = 'setting-link_';
        $out = '';
        $field_ids = isset($data[$pre . 'field_ids']) ? json_decode($data[$pre . 'field_ids']) : '';
        if (is_array($field_ids) || is_object($field_ids)) {
            $show_link_name = isset($instance['show_link_name']) && $instance['show_link_name'] ? true : false;
            $open_new_window = isset($instance['open_new_window']) && $instance['open_new_window'] ? true : false;
            $new_window_attr = $open_new_window ? 'target="_blank"' : '';
            $icon_type = themify_check($pre . 'icon_type') ? themify_get($pre . 'icon_type') : 'image-icon';
            // Icon Size
            $icon_size = isset($instance['icon_size']) && '' != $instance['icon_size'] ? $instance['icon_size'] : 'icon-medium';
            // Orientation
            $orientation = isset($instance['orientation']) && '' != $instance['orientation'] ? $instance['orientation'] : 'horizontal';
            $out .= '<ul class="social-links ' . $orientation . '">';
            foreach ($field_ids as $key => $fid) {
                $type_val = isset($data[$pre . 'type_' . $fid]) ? $data[$pre . 'type_' . $fid] : '';
                if ($type_val != $icon_type) {
                    continue;
                }
                $title_name = $pre . 'title_' . $fid;
                if (function_exists('icl_t')) {
                    $title_val = icl_t('Themify', $title_name, $data[$title_name]);
                } else {
                    $title_val = isset($data[$title_name]) ? $data[$title_name] : '';
                }
                $link_name = $pre . 'link_' . $fid;
                $link_val = isset($data[$link_name]) ? trim($data[$link_name]) : '';
                if ('' == $link_val) {
                    continue;
                }
                // Image Icon
                $img_name = $pre . 'img_' . $fid;
                $img_val = !isset($data[$img_name]) || '' == $data[$img_name] ? '' : '<img src="' . $data[$img_name] . '" />';
                // Font Icon
                $font_icon = '';
                if ($font_icon_class = themify_get($pre . 'ficon_' . $fid)) {
                    $fi_style = '';
                    $font_icon_class = 'fa ' . $font_icon_class;
                    if (stripos($font_icon_class, 'icon-') !== false) {
                        $font_icon_class = str_replace('icon-', 'fa-', $font_icon_class);
                    }
                    if ($font_icon_color = themify_get($pre . 'ficolor_' . $fid)) {
                        $fi_style .= 'color: #' . $font_icon_color . ';';
                    }
                    if ($font_icon_bgcolor = themify_get($pre . 'fibgcolor_' . $fid)) {
                        $fi_style .= 'background-color: #' . $font_icon_bgcolor . ';';
                    }
                    if ('' != $fi_style) {
                        $fi_style = 'style="' . $fi_style . '"';
                    }
                    $font_icon = '<i class="' . $font_icon_class . '" ' . $fi_style . '></i>';
                }
                if ('' != $link_val) {
                    $out .= sprintf('
							<li class="social-link-item %s %s %s">
								<a href="%s" title="%s" %s>%s %s %s</a>
							</li>
							<!-- /themify-link-item -->', sanitize_title($title_val), $icon_type, $icon_size, esc_attr($link_val), $title_val, $new_window_attr, $font_icon, $img_val, $show_link_name ? $title_val : '');
                }
            }
            $out .= '</ul>';
        }
        echo $out;
        /* After widget (defined by themes). */
        echo $after_widget;
    }
예제 #15
0
<?php

/**
 * Template to load footer widgets.
 * @package themify
 * @since 1.0.0
 */
$footer_widget_option = '' == themify_get('setting-footer_widgets') ? 'footerwidget-3col' : themify_get('setting-footer_widgets');
if ($footer_widget_option != 'none') {
    $columns = array('footerwidget-4col' => array('col4-1', 'col4-1', 'col4-1', 'col4-1'), 'footerwidget-3col' => array('col3-1', 'col3-1', 'col3-1'), 'footerwidget-2col' => array('col4-2', 'col4-2'), 'footerwidget-1col' => array(''));
    if (themify_theme_has_widgets('footer-widget-', $columns[$footer_widget_option])) {
        ?>

		<div class="footer-widgets clearfix">
			<?php 
        $x = 0;
        foreach ($columns[$footer_widget_option] as $col) {
            $x++;
            $class = 1 == $x ? 'first' : '';
            ?>
				<div class="<?php 
            echo esc_attr($col . ' ' . $class);
            ?>
">
					<?php 
            dynamic_sidebar('footer-widget-' . $x);
            ?>
				</div>
			<?php 
        }
        ?>
예제 #16
0
/**
 * Default Page Layout Module
 * @param array $data Theme settings data
 * @return string Markup for module.
 * @since 1.0.0
 */
function themify_default_page_layout($data = array())
{
    $data = themify_get_data();
    /**
     * Theme Settings Option Key Prefix
     * @var string
     */
    $prefix = 'setting-default_page_';
    /**
     * Sidebar placement options
     * @var array
     */
    $sidebar_location_options = array(array('value' => 'sidebar1', 'img' => 'images/layout-icons/sidebar1.png', 'selected' => true, 'title' => __('Sidebar Right', 'themify')), array('value' => 'sidebar1 sidebar-left', 'img' => 'images/layout-icons/sidebar1-left.png', 'title' => __('Sidebar Left', 'themify')), array('value' => 'sidebar-none', 'img' => 'images/layout-icons/sidebar-none.png', 'title' => __('No Sidebar', 'themify')));
    /**
     * Tertiary options <blank>|yes|no
     * @var array
     */
    $default_options = array(array('name' => '', 'value' => ''), array('name' => __('Yes', 'themify'), 'value' => 'yes'), array('name' => __('No', 'themify'), 'value' => 'no'));
    /**
     * Module markup
     * @var string
     */
    $output = '';
    /**
     * Page sidebar placement
     */
    $output .= '<p>
					<span class="label">' . __('Page Sidebar Option', 'themify') . '</span>';
    $val = isset($data[$prefix . 'layout']) ? $data[$prefix . 'layout'] : '';
    foreach ($sidebar_location_options as $option) {
        if (('' == $val || !$val || !isset($val)) && (isset($option['selected']) && $option['selected'])) {
            $val = $option['value'];
        }
        if ($val == $option['value']) {
            $class = "selected";
        } else {
            $class = "";
        }
        $output .= '<a href="#" class="preview-icon ' . $class . '" title="' . $option['title'] . '"><img src="' . THEME_URI . '/' . $option['img'] . '" alt="' . $option['value'] . '"  /></a>';
    }
    $output .= '<input type="hidden" name="' . $prefix . 'layout" class="val" value="' . $val . '" /></p>';
    /**
     * Hide Title in All Pages
     */
    $output .= '<p>
					<span class="label">' . __('Hide Title in All Pages', 'themify') . '</span>
					<select name="setting-hide_page_title">' . themify_options_module($default_options, 'setting-hide_page_title') . '
					</select>
				</p>';
    /**
     * Page Comments
     */
    $pre = 'setting-comments_pages';
    $output .= '<p><span class="label">' . __('Page Comments', 'themify') . '</span><label for="' . $pre . '"><input type="checkbox" id="' . $pre . '" name="' . $pre . '" ' . checked(themify_get($pre), 'on', false) . ' /> ' . __('Disable comments in all Pages', 'themify') . '</label></p>';
    return $output;
}
예제 #17
0
 /**
  * Outputs custom post CSS at the end of a post
  * @since 1.0.0
  */
 function themify_theme_custom_post_css()
 {
     global $themify;
     $post_id = '.section-post.post-' . get_the_ID();
     $css = array();
     $style = '';
     if (!isset($themify->google_fonts)) {
         $themify->google_fonts = '';
     }
     $rules = array("{$post_id}, {$post_id} h1, {$post_id} h2, {$post_id} h3, {$post_id} h4, {$post_id} h5, {$post_id} h6" => array(array('prop' => 'font-size', 'key' => array('font_size', 'font_size_unit')), array('prop' => 'font-family', 'key' => 'font_family'), array('prop' => 'color', 'key' => 'font_color')), "{$post_id} .section-title" => array(array('prop' => 'font-size', 'key' => array('title_font_size', 'font_size_unit')), array('prop' => 'font-family', 'key' => 'title_font_family'), array('prop' => 'color', 'key' => 'title_font_color')), $post_id => array(array('prop' => 'background-color', 'key' => 'background_color'), array('prop' => 'background-image', 'key' => 'background_image'), array('prop' => 'background-repeat', 'key' => 'background_repeat'), array('prop' => 'background-position', 'key' => array('background_position_x', 'background_position_y'))), "{$post_id} a" => array(array('prop' => 'color', 'key' => 'link_color')));
     foreach ($rules as $selector => $property) {
         foreach ($property as $val) {
             $prop = $val['prop'];
             $key = $val['key'];
             if (is_array($key)) {
                 if ($prop == 'font-size' && themify_check($key[0])) {
                     $css[$selector][$prop] = $prop . ': ' . themify_get($key[0]) . themify_get($key[1]);
                 }
                 if ($prop == 'background-position' && themify_check($key[0])) {
                     $css[$selector][$prop] = $prop . ': ' . themify_get($key[0]) . ' ' . themify_get($key[1]);
                 }
             } elseif (themify_check($key) && 'default' != themify_get($key)) {
                 if ($prop == 'color' || stripos($prop, 'color')) {
                     $css[$selector][$prop] = $prop . ': #' . themify_get($key);
                 } elseif ($prop == 'background-image') {
                     $css[$selector][$prop] = $prop . ': url(' . themify_get($key) . ')';
                 } elseif ($prop == 'font-family') {
                     $font = themify_get($key);
                     $css[$selector][$prop] = $prop . ': ' . $font;
                     if (!in_array($font, themify_get_web_safe_font_list(true))) {
                         $themify->google_fonts .= str_replace(' ', '+', $font . '|');
                     }
                 } else {
                     $css[$selector][$prop] = $prop . ': ' . themify_get($key);
                 }
             }
         }
         if (!empty($css[$selector])) {
             $style .= "{$selector} {\n\t" . implode(";\n\t", $css[$selector]) . "\n}\n";
         }
     }
     if ('' != $style) {
         echo "\n<!-- {$post_id} Style -->\n<style>\n{$style}</style>\n<!-- End {$post_id} Style -->\n";
     }
 }
 /**
  * Enqueues Google Fonts
  * 
  * @since 2.2.6
  * @since 2.2.7 Fonts are enqueued in a single call.
  */
 function enqueue_fonts()
 {
     $this->generate_css(true);
     // Call only to enqueue fonts.
     if (!empty($this->customizer_fonts)) {
         $subsets = 'latin';
         $user_subsets = str_replace(' ', '', themify_get('setting-webfonts_subsets'));
         if (!empty($user_subsets)) {
             $subsets .= ",{$user_subsets}";
         }
         $this->customizer_fonts = str_replace(' ', '+', implode('|', $this->customizer_fonts));
         wp_enqueue_style('customizer-google-fonts' . md5($this->customizer_fonts . $subsets), themify_https_esc('http://fonts.googleapis.com/css') . '?family=' . $this->customizer_fonts . '&subset=' . $subsets);
     }
 }
예제 #19
0
/**
 * Create a slider with posts retrieved through get_posts
 * @param Object $atts
 * @param String $content
 * @return String
 */
function themify_shortcode_post_slider($atts, $content = null)
{
    extract(shortcode_atts(array('visible' => '1', 'scroll' => '1', 'auto' => '0', 'pause_hover' => 'no', 'wrap' => 'yes', 'excerpt_length' => '20', 'speed' => 'normal', 'slider_nav' => 'yes', 'pager' => 'yes', 'limit' => '5', 'offset' => '0', 'category' => '', 'image' => 'yes', 'image_w' => '240px', 'image_h' => '180px', 'more_text' => __('More...', 'themify'), 'title' => 'yes', 'display' => 'none', 'post_meta' => 'no', 'post_date' => 'no', 'width' => '100%', 'height' => 'auto', 'class' => '', 'unlink_title' => 'no', 'unlink_image' => 'no', 'image_size' => 'medium', 'post_type' => 'post', 'taxonomy' => 'category', 'order' => 'DESC', 'orderby' => 'date', 'effect' => 'scroll'), $atts, 'themify_post_slider'));
    $postsliderstr = '';
    global $post;
    $query_args = array('numberposts' => $limit, 'offset' => $offset, 'post_type' => $post_type, 'order' => $order, 'orderby' => $orderby, 'suppress_filters' => false, 'post__not_in' => !is_home() ? array(get_the_ID()) : array());
    if ('' != $category) {
        $tax_query_terms = explode(',', $category);
        if (preg_match('#[a-z]#', $category)) {
            $query_args['tax_query'] = array(array('taxonomy' => $taxonomy, 'field' => 'slug', 'terms' => $tax_query_terms));
        } else {
            $exclude = array_filter($tax_query_terms, 'themify_is_negative_number');
            $query_args['tax_query'] = array('relation' => 'AND', array('taxonomy' => $taxonomy, 'field' => 'id', 'terms' => array_filter($tax_query_terms, 'themify_is_positive_number')), array('taxonomy' => $taxonomy, 'field' => 'id', 'terms' => array_map('themify_make_absolute_number', $exclude), 'operator' => 'NOT IN'));
        }
    }
    $posts = get_posts(apply_filters('themify_post_slider_shortcode_query_args', $query_args, $atts));
    if ($posts) {
        switch ($speed) {
            case 'fast':
                $speed = '.5';
                break;
            case 'normal':
                $speed = '1';
                break;
            case 'slow':
                $speed = '4';
                break;
        }
        $class .= ' effect-' . $effect;
        $js_data['slider_nav'] = $slider_nav == 'yes' ? 1 : 0;
        $js_data['pager'] = $pager == 'yes' ? 1 : 0;
        $js_data['wrapvar'] = $wrap == 'yes' ? 1 : 0;
        $js_data['play'] = intval($auto);
        $js_data['pause_hover'] = $pause_hover == 'yes' ? 1 : 0;
        $js_data['speed'] = $speed;
        $js_data['scroll'] = $scroll;
        $js_data['effect'] = $effect;
        $js_data['visible'] = intval($visible);
        $js_data['numsldr'] = rand(0, 1011) . uniqid();
        $postsliderstr = '<!-- shortcode post_slider --> <div id="slider-' . esc_attr($js_data['numsldr']) . '" style="width: ' . esc_attr($width) . '; height: ' . esc_attr($height) . ';" class="shortcode clearfix post-slider ' . $class . '">
		<ul class="slides" data-slider="' . esc_attr(json_encode($js_data)) . '">';
        unset($js_data);
        foreach ($posts as $post) {
            setup_postdata($post);
            global $more;
            $more = 0;
            $post_class = '';
            foreach (get_post_class() as $postclass) {
                $post_class .= " " . $postclass;
            }
            //get_post_class() as $postclass
            $postsliderstr .= '<li><div  class="slide-wrap ' . esc_attr($post_class) . '">';
            if ('yes' == $image) {
                $video_url = themify_get('video_url');
                if ('' != $video_url) {
                    $postsliderstr .= '<div class="post-video">';
                    global $wp_embed;
                    $postsliderstr .= $wp_embed->run_shortcode('[embed]' . $video_url . '[/embed]');
                    $postsliderstr .= '</div>';
                } else {
                    if ('no' == $unlink_image) {
                        $postsliderstr .= themify_get_image(array('image_size=' => $image_size, 'ignore' => true, 'w' => $image_w, 'h' => $image_h, 'alt' => get_the_title(), 'before' => '<p class="post-image"><a href="' . themify_get_featured_image_link() . '">', 'after' => '</a></p>'));
                    } else {
                        $postsliderstr .= themify_get_image(array('image_size' => $image_size, 'ignore' => true, 'w' => $image_w, 'h' => $image_h, 'alt' => get_the_title(), 'before' => '<p class="post-image">', 'after' => '</p>'));
                    }
                }
            }
            //'yes' == $image
            if ('yes' == $title) {
                if ('no' == $unlink_title) {
                    $postsliderstr .= '<h3 class="post-title"><a href="' . themify_get_featured_image_link() . '">' . get_the_title() . '</a></h3>';
                } else {
                    $postsliderstr .= '<h3 class="post-title">' . get_the_title() . '</h3>';
                }
            }
            //$title == "yes"
            if ($post_date == "yes") {
                $postsliderstr .= '<p class="post-date">' . get_the_date() . '</p>';
            }
            //$post_date == "yes"
            if ('yes' == $post_meta) {
                $postsliderstr .= '<p class="post-meta">
					<span class="post-author">' . get_the_author() . '</span>
					<span class="post-category">' . get_the_category_list(', ') . '</span>';
                if (comments_open()) {
                    ob_start();
                    comments_popup_link('0', '1', '%', 'comments-link', '');
                    $write_comments = ob_get_contents();
                    ob_clean();
                } else {
                    $write_comments = '';
                }
                $postsliderstr .= '<span class="post-comment">' . $write_comments . '</span>';
                if (has_tag()) {
                    $postsliderstr .= '<span class="post-tag">' . get_the_tag_list('', ', ') . '</span>';
                }
                $postsliderstr .= '</p>';
            }
            //$post_meta == "yes"
            if ('content' == $display) {
                $postsliderstr .= '<div class="post-content">' . wp_kses_post(themify_get_content($more_text)) . '</div></div></li>';
            }
            //$display == "content"
            if ('excerpt' == $display) {
                $postsliderstr .= '<div class="post-content">' . wp_kses_post(themify_excerpt($excerpt_length)) . '</div></div></li>';
            }
            //$display == "excerpt"
        }
        $postsliderstr .= '</ul>';
        $postsliderstr .= '</div>
		<!-- /shortcode post_slider -->';
        wp_reset_postdata();
    }
    //$posts
    return $postsliderstr;
}
예제 #20
0
						width: 150
					},
					onCreate : function (){
						jQuery('#footer-slider').css( {
							'height': 'auto',
							'visibility' : 'visible'
						});
					}
				});
			}
		});
		</script>
        <?php 
}
/** Output slider js on the footer if it's enabled */
if ('' == themify_get('setting-footer_slider_enabled') || 'on' == themify_get('setting-footer_slider_enabled')) {
    add_action('wp_footer', 'themify_footer_slider_action');
}
///////////////////////////////////////////
// Footer Sidebars Function
///////////////////////////////////////////
function themify_footer_widgets($data = array())
{
    $data = themify_get_data();
    $options = array(array("value" => "footerwidget-4col", "img" => "images/layout-icons/widget-4col.png"), array("value" => "footerwidget-3col", "img" => "images/layout-icons/widget-3col.png", "selected" => true), array("value" => "footerwidget-2col", "img" => "images/layout-icons/widget-2col.png"), array("value" => "footerwidget-1col", "img" => "images/layout-icons/widget-1col.png"), array("value" => "none", "img" => "images/layout-icons/none.png"));
    $val = $data['setting-footer_widgets'];
    $output = "";
    foreach ($options as $option) {
        if (($val == "" || !$val || !isset($val)) && $option['selected']) {
            $val = $option['value'];
        }
예제 #21
0
/**
 * Checks the area design setting and returns 'none' or a design option.
 *
 * @since 2.1.3
 *
 * @param string $key Main prefix for setting and field.
 * @param array $args
 *
 * @return mixed
 */
function themify_area_design($key = 'header', $args = array())
{
    $args = wp_parse_args($args, array('setting' => 'setting-' . $key . '_design', 'field' => $key . '_design', 'default' => $key . '-horizontal', 'values' => array('header-horizontal', 'header-block', 'none')));
    $is_shop = themify_is_woocommerce_active() && is_shop() ? true : false;
    if (is_singular() || $is_shop) {
        global $post;
        if ($is_shop && is_object($post)) {
            $temp_post = $post;
            $post = get_post(get_option('woocommerce_shop_page_id'));
        }
        $single = themify_get($args['field']);
        if ($is_shop && is_object($post)) {
            $post = $temp_post;
        }
        if (in_array($single, $args['values'])) {
            $design = $single;
        }
    }
    if (empty($design) || 'default' == $design) {
        $design = themify_check($args['setting']) ? themify_get($args['setting']) : $args['default'];
    }
    return $design;
}
예제 #22
0
					<?php 
    }
    ?>
				
					<div class="social-widget">
						<?php 
    dynamic_sidebar('social-widget');
    ?>

						<?php 
    if (!themify_check('setting-exclude_rss')) {
        ?>
							<div class="rss">
								<a href="<?php 
        if (themify_get('setting-custom_feed_url') != "") {
            echo themify_get('setting-custom_feed_url');
        } else {
            bloginfo('rss2_url');
        }
        ?>
"></a>
							</div>
						<?php 
    }
    ?>
					</div>
					<!-- /.social-widget -->
						
					<?php 
    if (!themify_check('setting-exclude_search_form')) {
        ?>
예제 #23
0
        ?>

			<?php 
        wp_link_pages(array('before' => '<p class="post-pagination"><strong>' . __('Pages:', 'themify') . ' </strong>', 'after' => '</p>', 'next_or_number' => 'number'));
        ?>

			<?php 
        get_template_part('includes/author-box', 'single');
        ?>

			<?php 
        get_template_part('includes/post-nav');
        ?>

			<?php 
        if (is_single() && 'none' != themify_get('setting-relationship_taxonomy')) {
            ?>
				<?php 
            get_template_part('includes/related-posts', 'loop');
            ?>
			<?php 
        }
        ?>

			<?php 
        comments_template();
        ?>

			<?php 
        themify_content_end();
        // hook
예제 #24
0
/**
 * Default Single Post Layout
 * @param array $data Theme settings data
 * @return string Markup for module.
 * @since 1.0.0
 */
function themify_default_post_layout($data = array())
{
    $data = themify_get_data();
    /**
     * Theme Settings Option Key Prefix
     * @var string
     */
    $prefix = 'setting-default_page_';
    /**
     * Tertiary options <blank>|yes|no
     * @var array
     */
    $default_options = array(array('name' => '', 'value' => ''), array('name' => __('Yes', 'themify'), 'value' => 'yes'), array('name' => __('No', 'themify'), 'value' => 'no'));
    /**
     * Sidebar placement options
     * @var array
     */
    $sidebar_location_options = array(array('value' => 'sidebar1', 'img' => 'images/layout-icons/sidebar1.png', 'selected' => true, 'title' => __('Sidebar Right', 'themify')), array('value' => 'sidebar1 sidebar-left', 'img' => 'images/layout-icons/sidebar1-left.png', 'title' => __('Sidebar Left', 'themify')), array('value' => 'sidebar-none', 'img' => 'images/layout-icons/sidebar-none.png', 'title' => __('No Sidebar', 'themify')));
    /**
     * Image alignment options
     * @var array
     */
    $alignment_options = array(array('name' => '', 'value' => ''), array('name' => __('Left', 'themify'), 'value' => 'left'), array('name' => __('Right', 'themify'), 'value' => 'right'));
    /**
     * Module markup
     * @var string
     */
    $output = '';
    /**
     * Post sidebar placement
     */
    $output .= '<p>
					<span class="label">' . __('Post Sidebar Option', 'themify') . '</span>';
    $val = isset($data[$prefix . 'post_layout']) ? $data[$prefix . 'post_layout'] : '';
    foreach ($sidebar_location_options as $option) {
        if (('' == $val || !$val || !isset($val)) && (isset($option['selected']) && $option['selected'])) {
            $val = $option['value'];
        }
        if ($val == $option['value']) {
            $class = 'selected';
        } else {
            $class = '';
        }
        $output .= '<a href="#" class="preview-icon ' . $class . '" title="' . $option['title'] . '"><img src="' . THEME_URI . '/' . $option['img'] . '" alt="' . $option['value'] . '"  /></a>';
    }
    $output .= '	<input type="hidden" name="' . $prefix . 'post_layout" class="val" value="' . $val . '" />
				</p>';
    /**
     * Hide Post Title
     */
    $output .= '<p>
					<span class="label">' . __('Hide Post Title', 'themify') . '</span>
					<select name="' . $prefix . 'post_title">' . themify_options_module($default_options, $prefix . 'post_title') . '
					</select>
				</p>';
    /**
     * Unlink Post Title
     */
    $output .= '<p>
					<span class="label">' . __('Unlink Post Title', 'themify') . '</span>
					<select name="' . $prefix . 'unlink_post_title">' . themify_options_module($default_options, $prefix . 'unlink_post_title') . '
					</select>
				</p>';
    /**
     * Hide Post Meta
     */
    $output .= themify_post_meta_options($prefix . 'post_meta', $data);
    /**
     * Hide Post Date
     */
    $output .= '<p>
					<span class="label">' . __('Hide Post Date', 'themify') . '</span>
					<select name="' . $prefix . 'post_date">' . themify_options_module($default_options, $prefix . 'post_date') . '
					</select>
				</p>';
    /**
     * Hide Featured Image
     */
    $output .= '<p>
					<span class="label">' . __('Hide Featured Image', 'themify') . '</span>
					<select name="' . $prefix . 'post_image">' . themify_options_module($default_options, $prefix . 'post_image') . '
					</select>
				</p>';
    /**
     * Unlink Featured Image
     */
    $output .= '<p>
					<span class="label">' . __('Unlink Featured Image', 'themify') . '</span>
					<select name="' . $prefix . 'unlink_post_image">' . themify_options_module($default_options, $prefix . 'unlink_post_image') . '
					</select>
				</p>';
    /**
     * Featured Image Sizes
     */
    $output .= themify_feature_image_sizes_select('image_post_single_feature_size');
    /**
     * Image dimensions
     */
    $output .= '<p>
			<span class="label">' . __('Image Size', 'themify') . '</span>
					<input type="text" class="width2" name="setting-image_post_single_width" value="' . themify_get('setting-image_post_single_width') . '" /> ' . __('width', 'themify') . ' <small>(px)</small>
					<input type="text" class="width2" name="setting-image_post_single_height" value="' . themify_get('setting-image_post_single_height') . '" /> ' . __('height', 'themify') . ' <small>(px)</small>
				</p>';
    /**
     * Featured Image Alignment
     */
    $output .= '<p>
					<span class="label">' . __('Featured Image Alignment', 'themify') . '</span>
					<select name="setting-image_post_single_align">' . themify_options_module($alignment_options, 'setting-image_post_single_align') . '
					</select>
				</p>';
    /**
     * Disable comments
     */
    $pre = 'setting-comments_posts';
    $output .= '<p><span class="label">' . __('Post Comments', 'themify') . '</span><label for="' . $pre . '"><input type="checkbox" id="' . $pre . '" name="' . $pre . '" ' . checked(themify_get($pre), 'on', false) . ' /> ' . __('Disable comments in all Posts', 'themify') . '</label></p>';
    /**
     * Show author box
     */
    $pre = 'setting-post_author_box';
    $output .= '<p><span class="label">' . __('Show Author Box', 'themify') . '</span><label for="' . $pre . '"><input type="checkbox" id="' . $pre . '" name="' . $pre . '" ' . checked(themify_get($pre), 'on', false) . ' /> ' . __('Show author box in all Posts', 'themify') . '</label></p>';
    /**
     * Remove Post Navigation
     */
    $pre = 'setting-post_nav_';
    $output .= '<p>
					<span class="label">' . __('Post Navigation', 'themify') . '</span>
					<label for="' . $pre . 'disable">
						<input type="checkbox" id="' . $pre . 'disable" name="' . $pre . 'disable" ' . checked(themify_get($pre . 'disable'), 'on', false) . '/> ' . __('Remove Post Navigation', 'themify') . '
						</label>
					<span class="pushlabel vertical-grouped">
						<label for="' . $pre . 'same_cat">
							<input type="checkbox" id="' . $pre . 'same_cat" name="' . $pre . 'same_cat" ' . checked(themify_get($pre . 'same_cat'), 'on', false) . '/> ' . __('Show only posts in the same category', 'themify') . '
						</label>
					</span>
				</p>';
    return $output;
}
function themify_img_settings($data = array())
{
    /*** Img.php Crop Option Array ***/
    $options = array(array("value" => "c", "name" => "Center"), array("value" => "t", "name" => "Top"), array("value" => "tr", "name" => "Top Right"), array("value" => "tl", "name" => "Top Left"), array("value" => "b", "name" => "Bottom"), array("value" => "br", "name" => "Bottom Right"), array("value" => "bl", "name" => "Bottom Left"), array("value" => "l", "name" => "Left"), array("value" => "r", "name" => "Right"));
    $options_vertical = array(array('name' => '', 'value' => ''), array('name' => 'Yes', 'value' => 'yes'), array('name' => 'No', 'value' => 'no'));
    if (themify_check('setting-img_settings_use')) {
        $checked_use = "checked='checked'";
    }
    if (themify_check('setting-img_settings_legacy')) {
        $checked_legacy = "checked='checked'";
    }
    $output = '<div class="module">
				<div class="label">img.php</div> 
				<div class="row">
					<input type="checkbox" name="setting-img_settings_use" ' . $checked_use . '/> Disable img.php globally<br>
					<small>(original source images will be used)</small>
				</div>
				<div class="label">Image Quality</div> 
				<div class="row">
					<input class="width2" type="text" name="setting-img_settings_quality" value="' . themify_get('setting-img_settings_quality') . '"> <small>max 100 (higher = better quality, but bigger file size)</small>
				</div>
				<div class="label">Cropping Alignment</div> 
				<div class="row">
					
					<select name="setting-img_settings_crop_option"><option></option>';
    foreach ($options as $option) {
        if ($option['value'] == themify_get('setting-img_settings_crop_option')) {
            $output .= '<option value="' . $option['value'] . '" selected="selected">' . $option['name'] . '</option>';
        } else {
            $output .= '<option value="' . $option['value'] . '">' . $option['name'] . '</option>';
        }
    }
    $output .= '</select></div>
				 <div class="label">Vertical Cropping</div> 
				<div class="row">
					
					<select name="setting-img_settings_vertical_crop_option">';
    foreach ($options_vertical as $option_vertical) {
        if ($option_vertical['value'] == themify_get('setting-img_settings_vertical_crop_option')) {
            $output .= '<option value="' . $option_vertical['value'] . '" selected="selected">' . $option_vertical['name'] . '</option>';
        } else {
            $output .= '<option value="' . $option_vertical['value'] . '">' . $option_vertical['name'] . '</option>';
        }
    }
    $output .= '</select> <small>(Select \'no\' to disable vertical cropping globally)</small></div>
				 </div>';
    return $output;
}
예제 #26
0
 function shortcode($atts = array(), $post_type)
 {
     extract($atts);
     // Parameters to get posts
     $args = array('post_type' => $post_type, 'posts_per_page' => $limit, 'order' => $order, 'orderby' => $orderby, 'suppress_filters' => false);
     $args['tax_query'] = $this->parse_category_args($category, $post_type);
     // Defines layout type
     $cpt_layout_class = $this->post_type . '-multiple clearfix type-multiple';
     $multiple = true;
     // Single post type or many single post types
     if ('' != $id) {
         if (strpos($id, ',')) {
             // Multiple ////////////////////////////////////
             $ids = explode(',', str_replace(' ', '', $id));
             foreach ($ids as $string_id) {
                 $int_ids[] = intval($string_id);
             }
             $args['post__in'] = $int_ids;
             $args['orderby'] = 'post__in';
         } else {
             // Single ///////////////////////////////////////
             $args['p'] = intval($id);
             $cpt_layout_class = $this->post_type . '-single';
             $multiple = false;
         }
     }
     // Get posts according to parameters
     $posts = get_posts(apply_filters('themify_' . $post_type . '_shortcode_args', $args));
     // Collect markup to be returned
     $out = '';
     if ($posts) {
         global $themify;
         // save a copy
         $themify_save = clone $themify;
         // override $themify object
         // set image link
         $themify->unlink_image = '' == $unlink_image || 'no' == $unlink_image ? 'no' : 'yes';
         $themify->hide_image = 'yes' == $image ? 'no' : 'yes';
         // set title link
         $themify->unlink_title = '' == $unlink_title || 'no' == $unlink_title ? 'no' : 'yes';
         $themify->hide_title = 'yes' == $title ? 'no' : 'yes';
         if (!$multiple) {
             if ('' == $image_w || get_post_meta($args['p'], 'image_width', true)) {
                 $themify->width = get_post_meta($args['p'], 'image_width', true);
             }
             if ('' == $image_h || get_post_meta($args['p'], 'image_height', true)) {
                 $themify->height = get_post_meta($args['p'], 'image_height', true);
             }
         } else {
             $themify->width = $image_w;
             $themify->height = $image_h;
         }
         $themify->use_original_dimensions = 'yes' == $use_original_dimensions ? 'yes' : 'no';
         $themify->display_content = $display;
         $themify->more_link = $more_link;
         $themify->more_text = $more_text;
         $themify->post_layout = $style;
         $themify->col_class = $this->column_class($style);
         if (is_singular('team')) {
             $teampre = 'setting-default_team_single_';
             $themify->hide_image = themify_check($teampre . 'hide_image') ? themify_get($teampre . 'hide_image') : 'no';
             $themify->hide_title = themify_check($teampre . 'hide_title') ? themify_get($teampre . 'hide_title') : 'no';
             $themify->unlink_image = themify_check($teampre . 'unlink_image') ? themify_get($teampre . 'unlink_image') : 'no';
             $themify->unlink_title = themify_check($teampre . 'unlink_title') ? themify_get($teampre . 'unlink_title') : 'no';
             $themify->width = themify_check($teampre . 'image_post_width') ? themify_get($teampre . 'image_post_width') : 144;
             $themify->height = themify_check($teampre . 'image_post_height') ? themify_get($teampre . 'image_post_height') : 144;
         }
         $out .= '<div class="loops-wrapper shortcode ' . $post_type . ' ' . $style . ' ' . $cpt_layout_class . '">';
         $out .= themify_get_shortcode_template($posts, 'includes/loop-team', 'index');
         $out .= $this->section_link($more_link, $more_text, $post_type);
         $out .= '</div>';
         $themify = clone $themify_save;
         // revert to original $themify state
     }
     return $out;
 }
예제 #27
0
 function item_template($id)
 {
     $output = '<li class="social-link-item" data-id="' . esc_attr($id) . '">';
     $output .= '<div class="social-drag">' . esc_html__('Drag to Sort &#8597;', 'themify') . '</div>';
     $output .= '<div class="row"><select name="' . esc_attr($this->pre . '-' . $id . '-location') . '" class="width6">';
     $locations = $this->get_locations();
     foreach ($this->get_location_groups() as $group => $label) {
         if (!empty($locations[$group])) {
             $output .= '<optgroup label="' . esc_attr($label) . '">';
             foreach ($locations[$group] as $key => $value) {
                 $output .= '<option value="' . esc_attr($key) . '" ' . selected(themify_get("{$this->pre}-{$id}-location"), $key, false) . '>' . esc_html($value) . '</option>';
             }
             $output .= '</optgroup>';
         }
     }
     $output .= '</select>';
     $output .= '&nbsp; <a class="button button-secondary themify-visibility-toggle" href="#" data-target="#' . $this->pre . '-' . $id . '-visibility"> ' . __('+ Conditions', 'themify') . ' </a> <input type="hidden" id="' . $this->pre . '-' . $id . '-visibility" name="' . esc_attr($this->pre . '-' . $id . '-visibility') . '" value="' . esc_attr(themify_get($this->pre . '-' . $id . '-visibility')) . '" /></div>';
     $output .= '<div class="row"><textarea class="widthfull" name="' . esc_attr($this->pre . '-' . $id . '-code') . '" rows="6" cols="73">' . esc_html(themify_get("{$this->pre}-{$id}-code")) . '</textarea>';
     $output .= '<a href="#" class="remove-item"><i class="ti-close"></i></a>';
     $output .= '</li>';
     return $output;
 }
예제 #28
0
                    ?>
</a></h3>
							<?php 
                }
                ?>
							
							<?php 
                if (themify_get('setting-header_slider_default_display') == 'content') {
                    ?>
								<div class="slide-excerpt">
								<?php 
                    the_content();
                    ?>
								</div>
							<?php 
                } elseif (!themify_get('setting-header_slider_default_display') || themify_get('setting-header_slider_default_display') == 'none') {
                    ?>
									<?php 
                    //none
                    ?>
							<?php 
                } else {
                    ?>
								<div class="slide-excerpt">
								<?php 
                    the_excerpt();
                    ?>
								</div>
							<?php 
                }
                ?>
">
			<?php 
        $width = $img_w_slider;
        $height = $img_h_slider;
        $unlink_feat = $unlink_feat_img_slider == 'yes' ? true : false;
        $param_image = 'w=' . $width . '&h=' . $height . '&ignore=true';
        if ($this->is_img_php_disabled()) {
            $param_image .= $image_size_slider != '' ? '&image_size=' . $image_size_slider : '';
        }
        if ($hide_feat_img_slider == '' || $hide_feat_img_slider == 'no') {
            // Check if there is a video url in the custom field
            if (themify_get('video_url') != '') {
                global $wp_embed;
                themify_before_post_image();
                // Hook
                echo $wp_embed->run_shortcode('[embed]' . esc_url(themify_get('video_url')) . '[/embed]');
                themify_after_post_image();
                // Hook
            } elseif ($post_image = themify_get_image($param_image)) {
                ?>
					<?php 
                themify_before_post_image();
                // Hook
                ?>
					<figure class="slide-image">
						<?php 
                if ($unlink_feat) {
                    ?>
							<?php 
                    echo wp_kses_post($post_image);
                    ?>
예제 #30
0
/**
 * Renders the option to disable responsive design
 *
 * @since 2.1.5
 * @return string
 */
function themify_disable_responsive_design_option($data = array())
{
    return '<p><label for="setting-disable_responsive_design"><input type="checkbox" id="setting-disable_responsive_design" name="setting-disable_responsive_design" ' . checked(themify_get('setting-disable_responsive_design'), 'on', false) . '/> ' . __('Check here to disable the responsive design.', 'themify') . '</label></p> <p><label for="setting-enable_mobile_zoom"><input type="checkbox" id="setting-enable_mobile_zoom" name="setting-enable_mobile_zoom" ' . checked(themify_get('setting-enable_mobile_zoom'), 'on', false) . '/> ' . __('Enable pinch to zoom on mobile (keep it disabled for better rendering)', 'themify') . '</label></p>';
}