예제 #1
0
파일: our-team.php 프로젝트: maesson/lyft
function woo_our_team_filter_content($content)
{
    if (!is_home() || !is_front_page()) {
        return;
    }
    $content = woo_text_trim($content, 12);
    return $content;
}
예제 #2
0
/**
 * Slider Magazine Excerpt Length
 * @since 5.6.0
 * @return string
 */
function woo_add_custom_excerpt_length($excerpt)
{
    // Set default values
    $settings = array('slider_magazine_excerpt' => 'true', 'slider_magazine_excerpt_length' => '15');
    // Compare default values against Theme Options
    $settings = woo_get_dynamic_values($settings);
    if ('true' == $settings['slider_magazine_excerpt']) {
        $excerpt = woo_text_trim($excerpt, $settings['slider_magazine_excerpt_length']);
    }
    return $excerpt;
}
예제 #3
0
 function woo_slider_magazine($args = null, $tags = null)
 {
     global $woo_options, $wp_query;
     // This is where our output will be added.
     $html = '';
     // Default slider settings.
     $defaults = array('id' => 'loopedSlider', 'echo' => true, 'excerpt_length' => '15', 'pagination' => false, 'width' => '940', 'height' => '350', 'order' => 'ASC', 'posts_per_page' => '5');
     // Setup width of slider and images
     $width = '610';
     $layout_width = get_option('woo_layout_width');
     if ($layout_width != '') {
         $layout_width = intval(str_replace('px', '', $layout_width));
     }
     $width = $layout_width;
     // Setup slider tags array
     $slider_tags = array();
     if (is_array($tags) && 0 < count($tags)) {
         $slider_tags = $tags;
     }
     if (!is_array($tags) && '' != $tags && !is_null($tags)) {
         $slider_tags = explode(',', $tags);
     }
     if (0 >= count($slider_tags)) {
         $slider_tags = explode(',', $woo_options['woo_slider_magazine_tags']);
         // Tags to be shown
     }
     if (0 < count($slider_tags)) {
         foreach ($slider_tags as $tags) {
             $tag = get_term_by('name', trim($tags), 'post_tag', 'ARRAY_A');
             if ($tag['term_id'] > 0) {
                 $tag_array[] = $tag['term_id'];
             }
         }
     }
     if (empty($tag_array)) {
         echo '<p class="woo-sc-box note">Please setup Featured Slider Tag(s) in your options panel. You must setup tags that are used on active posts.</p>';
         return;
     }
     // Setup the slider CSS class.
     $slider_css = '';
     if (isset($woo_options['woo_slider_pagination']) && $woo_options['woo_slider_pagination'] == 'true') {
         $slider_css = ' class="has-pagination woo-slideshow"';
     } else {
         $slider_css = ' class="woo-slideshow"';
     }
     // Setup height of slider.
     $height = $woo_options['woo_slider_magazine_height'];
     if ($height != '') {
         $defaults['height'] = $height;
     }
     // Setup the number of posts to show.
     $posts_per_page = $woo_options['woo_slider_magazine_entries'];
     if ($posts_per_page != '') {
         $defaults['posts_per_page'] = $posts_per_page;
     }
     // Setup the excerpt length.
     $excerpt_length = $woo_options['woo_slider_magazine_excerpt_length'];
     if ($excerpt_length != '') {
         $defaults['excerpt_length'] = $excerpt_length;
     }
     if ($width > 0 && $args['width'] == '') {
         $defaults['width'] = $width;
     }
     // Merge the arguments with defaults.
     $args = wp_parse_args($args, $defaults);
     if (isset($args['width']) && ($args['width'] <= 0 || $args['width'] == '') || !isset($args['width'])) {
         $args['width'] = '100';
     }
     if (isset($args['height']) && $args['height'] <= 0) {
         $args['height'] = '100';
     }
     // Allow child themes/plugins to filter these arguments.
     $args = apply_filters('woo_magazine_slider_args', $args);
     // Begin setting up HTML output.
     $image_args = 'width=' . $args['width'] . '&link=img&return=true&noheight=true';
     if (isset($woo_options['woo_slider_autoheight']) && $woo_options['woo_slider_autoheight'] != 'true') {
         $html .= '<div id="' . $args['id'] . '"' . $slider_css . ' style="max-height:' . $args['height'] . 'px;">' . "\n";
         $image_args .= '&height=' . $args['height'];
     } else {
         $html .= '<div id="' . $args['id'] . '"' . $slider_css . ' style="height:auto;">' . "\n";
     }
     $saved = $wp_query;
     $query = new WP_Query(array('tag__in' => $tag_array, 'posts_per_page' => $args['posts_per_page']));
     if ($query->have_posts()) {
         $count = 0;
         if (isset($woo_options['woo_slider_autoheight']) && $woo_options['woo_slider_autoheight'] != 'true') {
             $html .= '<ul class="slides" style="max-height:' . esc_attr($args['height']) . 'px;">' . "\n";
         } else {
             $html .= '<ul class="slides">' . "\n";
         }
         while ($query->have_posts()) {
             $query->the_post();
             global $post;
             $shownposts[$count] = $post->ID;
             $count++;
             $styles = 'width: ' . $args['width'] . 'px;';
             if ($count >= 2) {
                 $styles .= ' display:none;';
             } else {
                 $styles = '';
             }
             $url = get_permalink($post->ID);
             $html .= '<li id="slide-' . esc_attr($post->ID) . '" class="slide slide-number-' . esc_attr($count) . '" style="' . $styles . '">' . "\n";
             $html .= '<a href="' . $url . '" title="' . the_title_attribute(array('echo' => 0)) . '">' . woo_image($image_args) . '</a>' . "\n";
             $html .= '<div class="content">' . "\n";
             if ($woo_options['woo_slider_magazine_title'] == 'true') {
                 $html .= '<h2 class="title"><a href="' . $url . '" title="' . the_title_attribute(array('echo' => 0)) . '">' . get_the_title($post->ID) . '</a></h2>';
             }
             if ($woo_options['woo_slider_magazine_excerpt'] == 'true') {
                 $html .= '<div class="excerpt"><p>' . woo_text_trim(get_the_excerpt(), $excerpt_length) . '</p></div>' . "\n";
             }
             $html .= '</div>' . "\n";
             $html .= '</li>' . "\n";
         }
     }
     $wp_query = $saved;
     $html .= '</ul><!-- /.slides -->' . "\n";
     $html .= '</div>' . "\n";
     if (isset($woo_options['woo_slider_pagination']) && $woo_options['woo_slider_pagination'] == 'true') {
         $html .= '<div class="pagination-wrap slider-pagination"><ol class="flex-control-nav flex-control-paging">';
         for ($i = 0; $i < $count; $i++) {
             $html .= '<li><a>' . ($i + 1) . '</a></li>';
         }
         $html .= '</ol></div>';
     }
     if (get_option('woo_exclude') != $shownposts) {
         update_option("woo_exclude", $shownposts);
     }
     if ($args['echo']) {
         echo $html;
     }
     return $html;
 }
예제 #4
0
파일: featured.php 프로젝트: jaiweb/ASP
	    	    					<?php 
            $slide_title = get_the_title();
            echo woo_text_trim($slide_title, 25);
            ?>
	    	    				<?php 
            if (isset($url) && $url != '') {
                ?>
</a><?php 
            }
            ?>
	    	    			</h1>
	    	    			
	    	    			<div class="entry">
	    	    				<?php 
            $slide_excerpt = get_the_excerpt();
            echo woo_text_trim($slide_excerpt, 16);
            ?>
	    	    			</div>
	    	    		
	    	    		</header>
	    	    		
	    	    	</article>
	    	    	</div>
	    	    	<?php 
        }
        ?>
	            	
	            </li><!--/.slide-->
	            
			<?php 
    }
예제 #5
0
    			<header class="block">
    				<h1><?php 
    echo stripslashes($settings['homepage_blog_area_title']);
    ?>
</h1>
    			</header>
    			
    			<ul>

					<?php 
    while ($the_query->have_posts()) {
        $the_query->the_post();
        $count++;
        $excerpt = get_the_excerpt();
        if ('' == $excerpt) {
            $excerpt = woo_text_trim(strip_tags(get_the_content()), 12);
        }
        ?>
						<li class="blog-post<?php 
        if ($count == 1) {
            echo " first";
        }
        if ($count == 3) {
            echo " last";
            $count = 0;
        }
        ?>
">
			    			<?php 
        woo_image('noheight=true&width=' . $settings['blog_thumb_w'] . '&height=' . $settings['blog_thumb_h']);
        ?>
예제 #6
0
	    	    					<?php 
            $slide_title = get_the_title();
            echo woo_text_trim($slide_title, 25);
            ?>
	    	    				<?php 
            if (isset($url) && $url != '') {
                ?>
</a><?php 
            }
            ?>
	    	    			</h1>
	    	    			
	    	    			<div class="entry">
	    	    				<?php 
            $slide_excerpt = get_the_excerpt();
            echo woo_text_trim($slide_excerpt, 25);
            ?>
	    	    			</div>
	    	    		
	    	    		</header>
	    	    		
	    	    	</article>
	    	    	</div>
	    	    	<?php 
        }
        ?>
	            	
	            </li><!--/.slide-->
	            
			<?php 
    }
예제 #7
0
function woo_meta()
{
    global $post;
    global $wpdb;
    if (!empty($post)) {
        $post_id = $post->ID;
    }
    // Basic Output
    echo '<meta http-equiv="Content-Type" content="' . get_bloginfo('html_type') . '; charset=' . get_bloginfo('charset') . '" />' . "\n";
    // Under SETTIGNS > PRIVACY in the WordPress backend
    if (get_option('blog_public') == 0) {
        return;
    }
    //3rd Party Plugins
    $use_third_party_data = false;
    if (get_option('seo_woo_use_third_party_data') == 'true') {
        $use_third_party_data = true;
    }
    if ((class_exists('All_in_One_SEO_Pack') || class_exists('Headspace_Plugin') || class_exists('WPSEO_Admin') || class_exists('WPSEO_Frontend')) && $use_third_party_data == true) {
        return;
    }
    // Robots
    if (!class_exists('All_in_One_SEO_Pack') && !class_exists('Headspace_Plugin') && !class_exists('WPSEO_Admin') && !class_exists('WPSEO_Frontend')) {
        $index = 'index';
        $follow = 'follow';
        if (is_category() && get_option('seo_woo_meta_indexing_category') != 'true') {
            $index = 'noindex';
        } elseif (is_tag() && get_option('seo_woo_meta_indexing_tag') != 'true') {
            $index = 'noindex';
        } elseif (is_post_type_archive() && get_option('seo_woo_meta_indexing_posttype') != 'true') {
            $index = 'noindex';
        } elseif (is_tax() && get_option('seo_woo_meta_indexing_taxonomy') != 'true') {
            $index = 'noindex';
        } elseif (is_search() && get_option('seo_woo_meta_indexing_search') != 'true') {
            $index = 'noindex';
        } elseif (is_author() && get_option('seo_woo_meta_indexing_author') != 'true') {
            $index = 'noindex';
        } elseif (is_date() && get_option('seo_woo_meta_indexing_date') != 'true') {
            $index = 'noindex';
        }
        // Set to nofollow
        if (get_option('seo_woo_meta_single_follow') == 'true') {
            $follow = 'nofollow';
        }
        // Set individual post/page to follow/unfollow
        if (is_singular()) {
            if ($follow == 'follow' and get_post_meta($post->ID, 'seo_follow', true) == 'true') {
                $follow = 'nofollow';
            } elseif ($follow == 'nofollow' and get_post_meta($post->ID, 'seo_follow', true) == 'true') {
                $follow = 'follow';
            }
        }
        if (is_singular() && get_post_meta($post->ID, 'seo_noindex', true) == 'true') {
            $index = 'noindex';
        }
        echo '<meta name="robots" content="' . $index . ', ' . $follow . '" />' . "\n";
    }
    /* Description */
    $description = '';
    $home_desc_option = get_option('seo_woo_meta_home_desc');
    $singular_desc_option = get_option('seo_woo_meta_single_desc');
    //Check if there is a custom value added to post meta
    $wooseo_desc = get_post_meta($post->ID, 'seo_description', true);
    // WooSEO
    $aio_desc = get_post_meta($post->ID, '_aioseop_description', true);
    // All-in-One SEO Pack
    $headspace_desc = get_post_meta($post->ID, '_headspace_description', true);
    // Headspace SEO
    $wpseo_desc = get_post_meta($post->ID, '_yoast_wpseo_metadesc', true);
    // WordPress SEO
    //Singular setup
    if (!empty($aio_desc) and $use_third_party_data) {
        $singular_desc_option = 'aioseo';
    } elseif (!empty($headspace_desc) and $use_third_party_data) {
        $singular_desc_option = 'headspace';
    } elseif (!empty($wpseo_desc) and $use_third_party_data) {
        $singular_desc_option = 'wpseo';
    }
    if (is_home() or is_front_page()) {
        switch ($home_desc_option) {
            case 'a':
                $description = '';
                break;
            case 'b':
                $description = get_bloginfo('description');
                break;
            case 'c':
                $description = get_option('seo_woo_meta_home_desc_custom');
                break;
        }
    } elseif (is_singular()) {
        switch ($singular_desc_option) {
            case 'a':
                $description = '';
                break;
            case 'b':
                $description = trim(strip_tags($wooseo_desc));
                break;
            case 'c':
                if (is_single()) {
                    $posts = get_posts("p={$post_id}");
                }
                if (is_page()) {
                    $posts = get_posts("page_id={$post_id}&post_type=page");
                }
                foreach ($posts as $post) {
                    setup_postdata($post);
                    $post_content = get_the_excerpt();
                    if (empty($post_content)) {
                        // $post_content = get_the_content();
                        $post_content = strip_tags(strip_shortcodes($post->post_content));
                    }
                }
                // $post_content = htmlentities(trim(strip_tags(strip_shortcodes($post_content))), ENT_QUOTES, 'UTF-8' ); // Replaced with line below to accommodate special characters. // 2010-11-15.
                // $post_content = html_entity_decode(trim(strip_tags(strip_shortcodes($post_content))), ENT_QUOTES, 'UTF-8' ); // Replaced to fix PHP4 compatibility issue. // 2010-12-09.
                // $post_content = utf8_decode( trim( strip_tags( strip_shortcodes( $post_content ) ) ) );
                // $post_content = html_entity_decode( trim( strip_tags( strip_shortcodes( $post_content ) ) ) );
                // $post_content = esc_html( htmlspecialchars ( strip_shortcodes( $post_content ) ) );
                $post_content = esc_attr(strip_tags(strip_shortcodes($post_content)));
                $description = woo_text_trim($post_content, 30);
                break;
            case 'aioseo':
                $description = $aio_desc;
                // All-in-One Description
                break;
            case 'headspace':
                $description = $headspace_desc;
                // Headspace Description
                break;
            case 'wpseo':
                $description = $wpseo_desc;
                // WordPress SEO Description
                break;
        }
    }
    if (empty($description) and get_option('seo_woo_meta_single_desc_sitewide') == 'true') {
        $description = get_option('seo_woo_meta_single_desc_custom');
    }
    // $description = htmlspecialchars($description, ENT_QUOTES, 'UTF-8' ); // Replaced with line below to accommodate special characters. // 2010-11-15.
    $description = esc_attr($description);
    $description = stripslashes($description);
    // Faux-htmlentities using an array of key => value pairs.
    // TO DO: Clean-up and move to a re-usable function.
    $faux_htmlentities = array('& ' => '&amp; ', '<' => '&lt;', '>' => '&gt;');
    foreach ($faux_htmlentities as $old => $new) {
        $description = str_replace($old, $new, $description);
    }
    // End FOREACH Loop
    if (!empty($description)) {
        echo '<meta name="description" content="' . $description . '" />' . "\n";
    }
    /* Keywords */
    $keywords = '';
    $home_key_option = get_option('seo_woo_meta_home_key');
    $singular_key_option = get_option('seo_woo_meta_single_key');
    //Check if there is a custom value added to post meta
    $wooseo_keywords = get_post_meta($post->ID, 'seo_keywords', true);
    // WooSEO
    $aio_keywords = get_post_meta($post->ID, '_aioseop_keywords', true);
    // All-in-One SEO Pack
    $headspace_keywords = get_post_meta($post->ID, '_headspace_keywords', true);
    // Headspace SEO
    $wpseo_keywords = get_post_meta($post->ID, '_yoast_wpseo_focuskw', true);
    // WordPress SEO
    //Singular setup
    if (!empty($aio_keywords) and $use_third_party_data) {
        $singular_key_option = 'aioseo';
    } elseif (!empty($headspace_keywords) and $use_third_party_data) {
        $singular_key_option = 'headspace';
    } elseif (!empty($wpseo_keywords) and $use_third_party_data) {
        $singular_key_option = 'wpseo';
    }
    if (is_home() or is_front_page()) {
        switch ($home_key_option) {
            case 'a':
                $keywords = '';
                break;
            case 'c':
                $keywords = get_option('seo_woo_meta_home_key_custom');
                break;
        }
    } elseif (is_singular()) {
        switch ($singular_key_option) {
            case 'a':
                $keywords = '';
                break;
            case 'b':
                $keywords = $wooseo_keywords;
                break;
            case 'c':
                $the_keywords = array();
                //Tags
                if (get_the_tags($post->ID)) {
                    foreach (get_the_tags($post->ID) as $tag) {
                        $tag_name = $tag->name;
                        $the_keywords[] = strtolower($tag_name);
                    }
                }
                //Cats
                if (get_the_category($post->ID)) {
                    foreach (get_the_category($post->ID) as $cat) {
                        $cat_name = $cat->name;
                        $the_keywords[] = strtolower($cat_name);
                    }
                }
                //Other Taxonomies
                $all_taxonomies = get_taxonomies();
                $addon_taxonomies = array();
                if (!empty($all_taxonomies)) {
                    foreach ($all_taxonomies as $key => $taxonomies) {
                        if ($taxonomies != 'category' and $taxonomies != 'post_tag' and $taxonomies != 'nav_menu' and $taxonomies != 'link_category') {
                            $addon_taxonomies[] = $taxonomies;
                        }
                    }
                }
                $addon_terms = array();
                if (!empty($addon_taxonomies)) {
                    foreach ($addon_taxonomies as $taxonomies) {
                        $addon_terms[] = get_the_terms($post->ID, $taxonomies);
                    }
                }
                if (!empty($addon_terms)) {
                    foreach ($addon_terms as $addon) {
                        if (!empty($addon)) {
                            foreach ($addon as $term) {
                                $the_keywords[] = strtolower($term->name);
                            }
                        }
                    }
                }
                $keywords = implode(",", $the_keywords);
                break;
            case 'aioseo':
                $keywords = $aio_keywords;
                // All-in-One Title
                break;
            case 'headspace':
                $keywords = $headspace_keywords;
                // Headspace Title
                break;
            case 'wpseo':
                $keywords = $wpseo_keywords;
                // Headspace Title
                break;
        }
    }
    if (empty($keywords) and get_option('seo_woo_meta_single_key_sitewide') == 'true') {
        $keywords = get_option('seo_woo_meta_single_key_custom');
    }
    $keywords = htmlspecialchars($keywords, ENT_QUOTES, 'UTF-8');
    $keywords = stripslashes($keywords);
    if (!empty($keywords)) {
        echo '<meta name="keywords" content="' . $keywords . '" />' . "\n";
    }
}
예제 #8
0
 function woo_slider_magazine($args = null, $tags = null)
 {
     global $woo_options, $wp_query;
     // Exit if this isn't the first page in the loop
     if (is_paged()) {
         return;
     }
     // If WooSlider is enabled, let's use it instead
     if (class_exists('WooSlider')) {
         if (version_compare(get_option('wooslider-version'), '2.0.2') >= 0) {
             echo '<div class="wooslider-slider-magazine">';
             woo_wooslider_magazine();
             echo '</div><!-- /.wooslider-slider-magazine -->';
             return;
         }
     }
     // This is where our output will be added.
     $html = '';
     // Default slider settings.
     $defaults = array('id' => 'loopedSlider', 'echo' => true, 'excerpt_length' => '15', 'pagination' => false, 'width' => '960', 'order' => 'ASC', 'posts_per_page' => '5');
     // Setup width of slider and images
     $width = '623';
     if (isset($woo_options['woo_layout']) && 'one-col' == $woo_options['woo_layout'] && isset($woo_options['woo_layout_width']) && '' != $woo_options['woo_layout_width']) {
         $width = intval(str_replace('px', '', $woo_options['woo_layout_width']));
     }
     // Setup slider tags array
     $slider_tags = array();
     if (is_array($tags) && 0 < count($tags)) {
         $slider_tags = $tags;
     }
     if (!is_array($tags) && '' != $tags && !is_null($tags)) {
         $slider_tags = explode(',', $tags);
     }
     if (0 >= count($slider_tags)) {
         $slider_tags = explode(',', $woo_options['woo_slider_magazine_tags']);
         // Tags to be shown
     }
     if (0 < count($slider_tags)) {
         foreach ($slider_tags as $tags) {
             $tag = get_term_by('name', trim($tags), 'post_tag', 'ARRAY_A');
             if ($tag['term_id'] > 0) {
                 $tag_array[] = $tag['term_id'];
             }
         }
     }
     if (empty($tag_array)) {
         echo do_shortcode('[box type="alert"]' . __('Setup slider by adding <strong>Post Tags</strong> in <em>Magazine Template > Posts Slider</em>.', 'woothemes') . '[/box]');
         return;
     }
     // Setup the slider CSS class.
     $slider_css = '';
     if (isset($woo_options['woo_slider_pagination']) && $woo_options['woo_slider_pagination'] == 'true') {
         $slider_css = ' class="magazine-slider has-pagination woo-slideshow"';
     } else {
         $slider_css = ' class="magazine-slider woo-slideshow"';
     }
     // Setup the number of posts to show.
     $posts_per_page = $woo_options['woo_slider_magazine_entries'];
     if ($posts_per_page != '') {
         $defaults['posts_per_page'] = $posts_per_page;
     }
     // Setup the excerpt length.
     $excerpt_length = $woo_options['woo_slider_magazine_excerpt_length'];
     if ($excerpt_length != '') {
         $defaults['excerpt_length'] = $excerpt_length;
     }
     if ($width > 0 && $args['width'] == '') {
         $defaults['width'] = $width;
     }
     // Merge the arguments with defaults.
     $args = wp_parse_args($args, $defaults);
     if (isset($args['width']) && ($args['width'] <= 0 || $args['width'] == '') || !isset($args['width'])) {
         $args['width'] = '100';
     }
     // Allow child themes/plugins to filter these arguments.
     $args = apply_filters('woo_magazine_slider_args', $args);
     // Begin setting up HTML output.
     $image_args = 'width=' . $args['width'] . '&link=img&return=true&noheight=true';
     if (apply_filters('woo_slider_autoheight', true)) {
         $html .= '<div id="' . $args['id'] . '"' . $slider_css . ' style="height:auto;">' . "\n";
     } else {
         $html .= '<div id="' . $args['id'] . '"' . $slider_css . ' style="max-height:' . apply_filters('woo_slider_height', 350) . 'px;">' . "\n";
         $image_args .= '&height=' . apply_filters('woo_slider_height', 350);
     }
     $saved = $wp_query;
     $query = new WP_Query(array('tag__in' => $tag_array, 'posts_per_page' => $args['posts_per_page']));
     if ($query->have_posts()) {
         $count = 0;
         if (apply_filters('woo_slider_autoheight', true)) {
             $html .= '<ul class="slides">' . "\n";
         } else {
             $html .= '<ul class="slides" style="max-height:' . apply_filters('woo_slider_height', 350) . 'px;">' . "\n";
         }
         while ($query->have_posts()) {
             $query->the_post();
             global $post;
             $shownposts[$count] = $post->ID;
             $count++;
             $styles = 'width: ' . $args['width'] . 'px;';
             if ($count >= 2) {
                 $styles .= ' display:none;';
             } else {
                 $styles = '';
             }
             $url = get_permalink($post->ID);
             $html .= '<li id="slide-' . esc_attr($post->ID) . '" class="slide slide-number-' . esc_attr($count) . '" style="' . $styles . '">' . "\n";
             $html .= '<a href="' . $url . '" title="' . the_title_attribute(array('echo' => 0)) . '">' . woo_image($image_args) . '</a>' . "\n";
             $html .= '<div class="content">' . "\n";
             if ($woo_options['woo_slider_magazine_title'] == 'true') {
                 $html .= '<h2 class="title"><a href="' . $url . '" title="' . the_title_attribute(array('echo' => 0)) . '">' . get_the_title($post->ID) . '</a></h2>';
             }
             if ($woo_options['woo_slider_magazine_excerpt'] == 'true') {
                 $excerpt = woo_text_trim(get_the_excerpt(), $excerpt_length);
                 if ('' != $excerpt) {
                     $html .= '<div class="excerpt"><p>' . $excerpt . '</p></div>' . "\n";
                 }
             }
             $html .= '</div>' . "\n";
             $html .= '</li>' . "\n";
         }
     }
     $wp_query = $saved;
     $html .= '</ul><!-- /.slides -->' . "\n";
     $html .= '</div>' . "\n";
     if (isset($woo_options['woo_slider_pagination']) && $woo_options['woo_slider_pagination'] == 'true') {
         $html .= '<div class="pagination-wrap slider-pagination"><ol class="flex-control-nav flex-control-paging">';
         for ($i = 0; $i < $count; $i++) {
             $html .= '<li><a>' . ($i + 1) . '</a></li>';
         }
         $html .= '</ol></div>';
     }
     if (get_option('woo_exclude') != $shownposts) {
         update_option("woo_exclude", $shownposts);
     }
     if ($args['echo']) {
         echo $html;
     }
     return $html;
 }
예제 #9
0
post_class();
?>
>

		<header>
			<?php 
if (isset($settings['home_blog_thumb']) && $settings['home_blog_thumb'] == 'true') {
    woo_image('width=' . $settings['blog_thumb_w'] . '&height=' . $settings['blog_thumb_h'] . '&class=thumbnail ' . $settings['blog_thumb_align']);
}
?>

			<h2><a href="<?php 
the_permalink();
?>
" rel="bookmark" title="<?php 
the_title_attribute();
?>
"><?php 
the_title();
?>
</a></h2>

		</header>

		<section class="entry">
			<?php 
echo woo_text_trim(get_the_excerpt(), 100);
?>
		</section>

	</article><!-- /.post -->
예제 #10
0
function woo_meta()
{
    global $post;
    global $wpdb;
    if (!empty($post)) {
        $post_id = $post->ID;
    }
    // Basic Output
    echo '<meta http-equiv="Content-Type" content="' . esc_attr(get_bloginfo('html_type')) . '; charset=' . esc_attr(get_bloginfo('charset')) . '" />' . "\n";
    // Under SETTIGNS > PRIVACY in the WordPress backend
    if (get_option('blog_public') == 0) {
        return;
    }
    //3rd Party Plugins
    $use_third_party_data = false;
    if (get_option('seo_woo_use_third_party_data') == 'true') {
        $use_third_party_data = true;
    }
    if ((class_exists('All_in_One_SEO_Pack') || class_exists('Headspace_Plugin') || class_exists('WPSEO_Admin') || class_exists('WPSEO_Frontend')) && $use_third_party_data == true) {
        return;
    }
    // Robots
    if (!class_exists('All_in_One_SEO_Pack') && !class_exists('Headspace_Plugin') && !class_exists('WPSEO_Admin') && !class_exists('WPSEO_Frontend')) {
        $index = 'index';
        $follow = 'follow';
        if (is_category() && get_option('seo_woo_meta_indexing_category') != 'true') {
            $index = 'noindex';
        } elseif (is_tag() && get_option('seo_woo_meta_indexing_tag') != 'true') {
            $index = 'noindex';
        } elseif (is_post_type_archive() && get_option('seo_woo_meta_indexing_posttype') != 'true') {
            $index = 'noindex';
        } elseif (is_tax() && get_option('seo_woo_meta_indexing_taxonomy') != 'true') {
            $index = 'noindex';
        } elseif (is_search() && get_option('seo_woo_meta_indexing_search') != 'true') {
            $index = 'noindex';
        } elseif (is_author() && get_option('seo_woo_meta_indexing_author') != 'true') {
            $index = 'noindex';
        } elseif (is_date() && get_option('seo_woo_meta_indexing_date') != 'true') {
            $index = 'noindex';
        }
        // Set to nofollow
        if (get_option('seo_woo_meta_single_follow') == 'true') {
            $follow = 'nofollow';
        }
        // Set individual post/page to follow/unfollow
        if (is_singular()) {
            if ($follow == 'follow' and get_post_meta($post->ID, 'seo_follow', true) == 'true') {
                $follow = 'nofollow';
            } elseif ($follow == 'nofollow' and get_post_meta($post->ID, 'seo_follow', true) == 'true') {
                $follow = 'follow';
            }
        }
        if (is_singular() && get_post_meta($post->ID, 'seo_noindex', true) == 'true') {
            $index = 'noindex';
        }
        echo '<meta name="robots" content="' . $index . ', ' . $follow . '" />' . "\n";
    }
    /* Description */
    $description = '';
    $home_desc_option = get_option('seo_woo_meta_home_desc');
    $singular_desc_option = get_option('seo_woo_meta_single_desc');
    //Check if there is a custom value added to post meta
    $wooseo_desc = false;
    $aio_desc = false;
    $headspace_desc = false;
    $wpseo_desc = false;
    if (isset($post->ID)) {
        $wooseo_desc = get_post_meta($post->ID, 'seo_description', true);
        // WooSEO
        $aio_desc = get_post_meta($post->ID, '_aioseop_description', true);
        // All-in-One SEO Pack
        $headspace_desc = get_post_meta($post->ID, '_headspace_description', true);
        // Headspace SEO
        $wpseo_desc = get_post_meta($post->ID, '_yoast_wpseo_metadesc', true);
        // WordPress SEO
    }
    // End If Statement
    //Singular setup
    if (!empty($aio_desc) and $use_third_party_data) {
        $singular_desc_option = 'aioseo';
    } elseif (!empty($headspace_desc) and $use_third_party_data) {
        $singular_desc_option = 'headspace';
    } elseif (!empty($wpseo_desc) and $use_third_party_data) {
        $singular_desc_option = 'wpseo';
    }
    if (is_home() or is_front_page()) {
        switch ($home_desc_option) {
            case 'a':
                $description = '';
                break;
            case 'b':
                $description = get_bloginfo('description');
                break;
            case 'c':
                $description = get_option('seo_woo_meta_home_desc_custom');
                break;
        }
    } elseif (is_singular()) {
        switch ($singular_desc_option) {
            case 'a':
                $description = '';
                break;
            case 'b':
                $description = trim(strip_tags($wooseo_desc));
                break;
            case 'c':
                $data = get_post(intval($post_id));
                if (null != $data && isset($data->post_content)) {
                    if (isset($data->post_excerpt) && '' != $data->post_excerpt) {
                        $post_content = $data->post_excerpt;
                    } else {
                        $post_content = $data->post_content;
                    }
                    $post_content = esc_attr(strip_tags(strip_shortcodes($post_content)));
                    $description = woo_text_trim($post_content, 30);
                }
                break;
            case 'aioseo':
                $description = $aio_desc;
                // All-in-One Description
                break;
            case 'headspace':
                $description = $headspace_desc;
                // Headspace Description
                break;
            case 'wpseo':
                $description = $wpseo_desc;
                // WordPress SEO Description
                break;
        }
    }
    if (empty($description) && get_option('seo_woo_meta_single_desc_sitewide') == 'true') {
        $description = get_option('seo_woo_meta_single_desc_custom');
    }
    $description = stripslashes(strip_tags(strip_shortcodes($description)));
    if (!empty($description)) {
        echo '<meta name="description" content="' . esc_attr($description) . '" />' . "\n";
    }
    /* Keywords */
    $keywords = '';
    $home_key_option = get_option('seo_woo_meta_home_key');
    $singular_key_option = get_option('seo_woo_meta_single_key');
    //Check if there is a custom value added to post meta
    $wooseo_desc = false;
    $aio_desc = false;
    $headspace_desc = false;
    $wpseo_desc = false;
    if (isset($post->ID)) {
        $wooseo_keywords = get_post_meta($post->ID, 'seo_keywords', true);
        // WooSEO
        $aio_keywords = get_post_meta($post->ID, '_aioseop_keywords', true);
        // All-in-One SEO Pack
        $headspace_keywords = get_post_meta($post->ID, '_headspace_keywords', true);
        // Headspace SEO
        $wpseo_keywords = get_post_meta($post->ID, '_yoast_wpseo_focuskw', true);
        // WordPress SEO
    }
    // End If Statement
    //Singular setup
    if (!empty($aio_keywords) and $use_third_party_data) {
        $singular_key_option = 'aioseo';
    } elseif (!empty($headspace_keywords) and $use_third_party_data) {
        $singular_key_option = 'headspace';
    } elseif (!empty($wpseo_keywords) and $use_third_party_data) {
        $singular_key_option = 'wpseo';
    }
    if (is_home() or is_front_page()) {
        switch ($home_key_option) {
            case 'a':
                $keywords = '';
                break;
            case 'c':
                $keywords = get_option('seo_woo_meta_home_key_custom');
                break;
        }
    } elseif (is_singular()) {
        switch ($singular_key_option) {
            case 'a':
                $keywords = '';
                break;
            case 'b':
                $keywords = $wooseo_keywords;
                break;
            case 'c':
                $the_keywords = array();
                //Tags
                if (get_the_tags($post->ID)) {
                    foreach (get_the_tags($post->ID) as $tag) {
                        $tag_name = $tag->name;
                        $the_keywords[] = strtolower($tag_name);
                    }
                }
                //Cats
                if (get_the_category($post->ID)) {
                    foreach (get_the_category($post->ID) as $cat) {
                        $cat_name = $cat->name;
                        $the_keywords[] = strtolower($cat_name);
                    }
                }
                //Other Taxonomies
                $all_taxonomies = get_taxonomies();
                $addon_taxonomies = array();
                if (!empty($all_taxonomies)) {
                    foreach ($all_taxonomies as $key => $taxonomies) {
                        if ($taxonomies != 'category' and $taxonomies != 'post_tag' and $taxonomies != 'nav_menu' and $taxonomies != 'link_category') {
                            $addon_taxonomies[] = $taxonomies;
                        }
                    }
                }
                $addon_terms = array();
                if (!empty($addon_taxonomies)) {
                    foreach ($addon_taxonomies as $taxonomies) {
                        $addon_terms[] = get_the_terms($post->ID, $taxonomies);
                    }
                }
                if (!empty($addon_terms)) {
                    foreach ($addon_terms as $addon) {
                        if (!empty($addon)) {
                            foreach ($addon as $term) {
                                $the_keywords[] = strtolower($term->name);
                            }
                        }
                    }
                }
                $keywords = implode(",", $the_keywords);
                break;
            case 'aioseo':
                $keywords = $aio_keywords;
                // All-in-One Title
                break;
            case 'headspace':
                $keywords = $headspace_keywords;
                // Headspace Title
                break;
            case 'wpseo':
                $keywords = $wpseo_keywords;
                // Headspace Title
                break;
        }
    }
    if (empty($keywords) and get_option('seo_woo_meta_single_key_sitewide') == 'true') {
        $keywords = get_option('seo_woo_meta_single_key_custom');
    }
    $keywords = htmlspecialchars($keywords, ENT_QUOTES, 'UTF-8');
    $keywords = stripslashes($keywords);
    if (!empty($keywords)) {
        echo '<meta name="keywords" content="' . esc_attr($keywords) . '" />' . "\n";
    }
}
    function woo_widget_tabs_latest($posts = 5, $size = 45)
    {
        global $post;
        $latest = get_posts('ignore_sticky_posts=1&numberposts=' . $posts . '&orderby=post_date&order=desc');
        foreach ($latest as $post) {
            setup_postdata($post);
            $excerpt = woo_text_trim(get_the_excerpt(), '15');
            ?>
	<li>
		<?php 
            if (get_option('woo_post_calendar') == "true") {
                ?>
<div class="ico-cal alignleft"><div class="ico-day"><?php 
                the_time('d');
                ?>
</div><div class="ico-month"><?php 
                the_time('M');
                ?>
</div></div><?php 
            } elseif ($size != 0) {
                woo_image('height=' . $size . '&width=' . $size . '&class=thumbnail&single=true');
            }
            ?>
		<div class="tab-content">
		<a title="<?php 
            the_title();
            ?>
" href="<?php 
            the_permalink();
            ?>
"><?php 
            the_title();
            ?>
</a>
		<span class="meta"><?php 
            the_time(get_option('date_format'));
            ?>
</span>
		<?php 
            if ($excerpt) {
                echo $excerpt;
            }
            ?>
		</div>
		<div class="fix"></div>
	</li>
	<?php 
        }
    }
예제 #12
0
    function widget($args, $instance)
    {
        extract($args);
        $title = $instance['title'];
        if (!$title) {
            $title = 'News from the blog';
        }
        $number = $instance['number'];
        $size = $instance['size'];
        if (!$size && size != 0) {
            $size = 70;
        }
        $align = $instance['align'];
        if (!$align) {
            $align = 'alignright';
        }
        ?>
		<?php 
        echo $before_widget;
        ?>

				<h3><?php 
        echo $title;
        ?>
</h3>
                <a class="rss" href="<?php 
        if (get_option('woo_feed_url') != "") {
            echo get_option('woo_feed_url');
        } else {
            echo bloginfo('url') . "/?feed=rss2";
        }
        ?>
" title="<?php 
        _e('Subscribe to our RSS feed', 'woothemes');
        ?>
"><img src="<?php 
        bloginfo('template_directory');
        ?>
/images/ico-rss-big.png" alt="RSS"/></a>
                
				
				<div>
					<?php 
        query_posts('posts_per_page=' . $number);
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                ?>
					    <div class="item">
                        	<?php 
                if ($size != 0) {
                    woo_image('width=' . $size . '&height=' . $size . '&class=thumbnail ' . $align);
                }
                ?>
 
                        	<a class="title" href="<?php 
                echo get_permalink($post->ID);
                ?>
" title="<?php 
                echo get_the_title($post->ID);
                ?>
"><?php 
                echo get_the_title($post->ID);
                ?>
</a>
                            <p class="post-meta">
                                <span class="small"><?php 
                _e('by', 'woothemes');
                ?>
</span> <span class="post-author"><?php 
                the_author_posts_link();
                ?>
</span>
                                <span class="small"><?php 
                _e('on', 'woothemes');
                ?>
</span> <span class="post-date"><?php 
                the_time(get_option('date_format'));
                ?>
</span>
                                <span class="small"><?php 
                _e('in', 'woothemes');
                ?>
</span> <span class="post-category"><?php 
                the_category(', ');
                ?>
</span>
                            </p>
                            <p><?php 
                echo woo_text_trim(get_the_excerpt(), 25);
                ?>
</p>
                        </div>
					    
					<?php 
            }
        }
        ?>
				</div>
			
		<?php 
        echo $after_widget;
        ?>
   
   <?php 
    }
예제 #13
0
function woo_meta()
{
    global $post;
    global $wpdb;
    if (!empty($post)) {
        $post_id = $post->ID;
    }
    // Basic Output
    echo '<meta http-equiv="Content-Type" content="' . get_bloginfo('html_type') . '; charset=' . get_bloginfo('charset') . '" />' . "\n";
    // Under SETTIGNS > PRIVACY in the WordPress backend
    if (get_option('blog_public') == 0) {
        return;
    }
    //3rd Party Plugins
    if (get_option('seo_woo_use_third_party_data') == 'true') {
        $use_third_party_data = true;
    }
    if ((class_exists('All_in_One_SEO_Pack') or class_exists('Headspace_Plugin')) and $third_party_data != true) {
        return;
    }
    // Robots
    $index = 'index';
    $follow = 'follow';
    if (is_category() && get_option('seo_woo_meta_category') != 'true') {
        $index = 'noindex';
    } elseif (is_tag() && get_option('seo_woo_meta_tag') != 'true') {
        $index = 'noindex';
    } elseif (is_search() && get_option('seo_woo_meta_search') != 'true') {
        $index = 'noindex';
    } elseif (is_author() && get_option('seo_woo_meta_author') != 'true') {
        $index = 'noindex';
    } elseif (is_archive() && get_option('seo_woo_meta_archive') != 'true') {
        $index = 'noindex';
    }
    if (is_singular() && get_post_meta($post->ID, 'seo_follow', true) != 'true') {
        $follow = 'nofollow';
    }
    if (get_option('seo_woo_meta_single_follow') == 'true') {
        $follow = 'follow';
    }
    echo '<meta name="robots" content="' . $index . ', ' . $follow . '" />' . "\n";
    /* Description */
    $description = '';
    $home_desc_option = get_option('seo_woo_meta_home_desc');
    $singular_desc_option = get_option('seo_woo_meta_single_desc');
    //Check if there is a custom value added to post meta
    $wooseo_desc = get_post_meta($post->ID, 'seo_description', true);
    //WooSEO
    $aio_desc = get_post_meta($post->ID, '_aioseop_description', true);
    //All-in-One SEO
    $headspace_desc = get_post_meta($post->ID, '_headspace_description', true);
    //Headspace SEO
    //Singular setup
    if (!empty($wooseo_desc)) {
        $singular_desc_option = 'b';
    } elseif (!empty($aio_desc) and $use_third_party_data) {
        $singular_desc_option = 'aioseo';
    } elseif (!empty($headspace_desc) and $use_third_party_data) {
        $singular_desc_option = 'headspace';
    }
    if (is_home() or is_front_page()) {
        switch ($home_desc_option) {
            case 'a':
                $description = '';
                break;
            case 'b':
                $description = get_bloginfo('description');
                break;
            case 'c':
                $description = htmlentities(get_option('seo_woo_meta_home_desc_custom'));
                break;
        }
    } elseif (is_singular()) {
        switch ($singular_desc_option) {
            case 'a':
                $description = '';
                break;
            case 'b':
                $description = htmlentities(trim(strip_tags($wooseo_desc)));
                // WooSEO Title
                break;
            case 'c':
                $data = $wpdb->get_results("SELECT * FROM {$wpdb->posts} WHERE ID={$post_id}");
                $post_content = $data[0]->post_excerpt;
                if (empty($post_content)) {
                    $post_content = $data[0]->post_content;
                    $post_content = htmlentities(trim(strip_tags(strip_shortcodes($post_content))));
                } else {
                    $post_content = htmlentities(trim(strip_tags(strip_shortcodes($post_content))));
                }
                $description = woo_text_trim($post_content, 30);
                break;
            case 'aioseo':
                $description = $aio_desc;
                // All-in-One Title
                break;
            case 'headspace':
                $description = $headspace_desc;
                // Headspace Title
                break;
        }
    }
    if (!empty($description)) {
        echo '<meta name="description" content="' . $description . '" />' . "\n";
    }
    /* Keywords */
    $keywords = '';
    $home_key_option = get_option('seo_woo_meta_home_key');
    $singular_key_option = get_option('seo_woo_meta_single_key');
    //Check if there is a custom value added to post meta
    $wooseo_keywords = get_post_meta($post->ID, 'seo_keywords', true);
    //WooSEO
    $aio_keywords = get_post_meta($post->ID, '_aioseop_keywords', true);
    //All-in-One SEO
    $headspace_keywords = get_post_meta($post->ID, '_headspace_keywords', true);
    //Headspace SEO
    //Singular setup
    if (!empty($wooseo_keywords)) {
        $singular_key_option = 'b';
    } elseif (!empty($aio_keywords) and $use_third_party_data) {
        $singular_key_option = 'aioseo';
    } elseif (!empty($headspace_keywords) and $use_third_party_data) {
        $singular_key_option = 'headspace';
    }
    if (is_home() or is_front_page()) {
        switch ($home_key_option) {
            case 'a':
                $keywords = '';
                break;
            case 'c':
                $keywords = htmlentities(get_option('seo_woo_meta_home_key_custom'));
                break;
        }
    } elseif (is_singular()) {
        switch ($singular_key_option) {
            case 'a':
                $keywords = '';
                break;
            case 'b':
                $keywords = htmlentities($wooseo_keywords);
                break;
            case 'c':
                $the_keywords = array();
                //Tags
                if (get_the_tags($post->ID)) {
                    foreach (get_the_tags($post->ID) as $tag) {
                        $tag_name = $tag->name;
                        $the_keywords[] = strtolower($tag_name);
                    }
                }
                //Cats
                if (get_the_category($post->ID)) {
                    foreach (get_the_category($post->ID) as $cat) {
                        $cat_name = $cat->name;
                        $the_keywords[] = strtolower($cat_name);
                    }
                }
                $keywords = implode(",", $the_keywords);
                break;
            case 'aioseo':
                $keywords = $aio_keywords;
                // All-in-One Title
                break;
            case 'headspace':
                $keywords = $headspace_keywords;
                // All-in-One Title
                break;
        }
    }
    if (!empty($keywords)) {
        echo '<meta name="keywords" content="' . htmlentities($keywords) . '" />' . "\n";
    }
}