Ejemplo n.º 1
0
 function illdy_archive_description($before = '', $after = '')
 {
     $description = apply_filters('get_the_archive_description', term_description());
     if (!empty($description)) {
         echo $before . $description . $after;
     }
 }
Ejemplo n.º 2
0
 /**
  * add meta_description
  *
  * hook after post has loaded to add a unique meta-description
  *
  */
 public static function meta_description()
 {
     $post = new \TimberPost();
     // check for custom field
     $description = wptexturize($post->get_field('meta_description'));
     if (is_tax()) {
         if ($temp = term_description(get_queried_object(), get_query_var('taxonomy'))) {
             $description = $temp;
         }
     } elseif (is_post_type_archive()) {
         if ($temp = get_the_archive_description()) {
             $description = $temp;
         }
     }
     // else use preview
     if (empty($description)) {
         $description = str_replace('', "'", $post->get_preview(40, true, false, true));
     }
     // finally use the blog description
     if (empty($description)) {
         $description = get_bloginfo('description', 'raw');
     }
     $description = esc_attr(wp_strip_all_tags($description));
     // limit to SEO recommended length
     if (strlen($description) > 155) {
         $description = substr($description, 0, 155);
         $description = \TimberHelper::trim_words($description, str_word_count($description) - 1);
     }
     return $description;
 }
Ejemplo n.º 3
0
 function wpex_post_subheading()
 {
     // Vars
     global $post;
     $output = '';
     // Posts & Pages
     if (is_singular()) {
         $post_id = $post->ID;
         $subheading = get_post_meta($post_id, 'wpex_post_subheading', true);
         $output = '';
         if ($subheading) {
             $output .= '<div class="clr page-subheading">';
             $output .= do_shortcode($subheading);
             $output .= '</div>';
         }
     }
     // Archives
     if (is_tax()) {
         $obj = get_queried_object();
         $taxonomy = $obj->taxonomy;
         $term_id = $obj->term_id;
         $description = term_description($term_id, $taxonomy);
         if (!empty($description)) {
             $output .= '<div class="clr page-subheading term-description">';
             $output .= $description;
             $output .= '</div>';
         }
     }
     // Return content
     return $output;
 }
Ejemplo n.º 4
0
function store_seo_info()
{
    if (get_post_type() == 'store' && !is_singular()) {
        $id = get_queried_object_id();
        if ((taxonomy_exists('products_category') || taxonomy_exists('products_tag')) && $id != 0) {
            $term_name = get_term_field('name', $id, 'products_category');
            $title = $term_name;
            $paged = get_query_var('paged');
            if ($paged > 1) {
                $title .= sprintf(__(' - 第 %s 页 ', 'tinection'), $paged);
            }
            $title .= ' - ' . get_bloginfo('name') . '商城';
            $keywords = $term_name . ",商城";
            $description = strip_tags(term_description());
        } elseif (is_archive() && $id == 0) {
            $title = ot_get_option('shop_archives_title', 'WordPress商店');
            $paged = get_query_var('paged');
            if ($paged > 1) {
                $title .= sprintf(__(' - 第 %s 页 ', 'tinection'), $paged);
            }
            $title .= ' - ' . get_bloginfo('name');
            $keywords = '商品归档,商城,归档';
            $description = get_bloginfo('name') . '商城';
        }
        $seo_text = '<title>' . $title . '</title><meta name="description" content="' . $description . '" /><meta name="keywords" content="' . $keywords . '" />';
    } else {
        $seo_text = '';
    }
    return $seo_text;
}
Ejemplo n.º 5
0
 public function register_meta_tags()
 {
     add_action('wp_head', function () {
         if (is_singular() && false == post_password_required()) {
             if ('' == ($description = get_the_excerpt())) {
                 $description = wp_trim_words(esc_html(strip_shortcodes(get_the_content())), 20, '...');
             }
         } elseif (is_category() && '' != category_description()) {
             $description = category_description();
         } elseif (is_tag() && '' != term_description()) {
             $description = term_description();
         } else {
             $description = get_bloginfo('description');
         }
         $description = esc_attr($description);
         echo "<meta name=\"description\" content=\"{$description}\" />\n";
         echo "<meta name=\"og:description\" content=\"{$description}\" />\n";
         if (is_singular() && false == post_password_required() && has_post_thumbnail()) {
             list($image, $width, $height) = wp_get_attachment_image_src(get_post_thumbnail_id(), 'facebook');
         } else {
             $image = apply_filters('', $this->get_theme_assets_url() . '/images/logo-fb.png');
         }
         $image = esc_url($image);
         echo "<meta name=\"og:image\" content=\"{$image}\" />\n";
         echo "<meta name=\"twitter:image\" content=\"{$image}\" />\n";
     });
 }
Ejemplo n.º 6
0
function description()
{
    if (is_home() || is_front_page()) {
        echo trim(of_get_option('site_description'));
    } elseif (is_category()) {
        $description = strip_tags(category_description());
        echo trim($description);
    } elseif (is_single()) {
        if (get_the_excerpt()) {
            echo get_the_excerpt();
        } else {
            global $post;
            $description = trim(str_replace(array("\r\n", "\r", "\n", " ", " "), " ", str_replace("\"", "'", strip_tags($post->post_content))));
            echo mb_substr($description, 0, 220, 'utf-8');
        }
    } elseif (is_search()) {
        echo '“';
        the_search_query();
        echo '”为您找到结果 ';
        global $wp_query;
        echo $wp_query->found_posts;
        echo ' 个';
    } elseif (is_tag()) {
        $description = strip_tags(tag_description());
        echo trim($description);
    } else {
        $description = strip_tags(term_description());
        echo trim($description);
    }
}
function ubik_seo_meta_description($desc = '')
{
    // Generate a meta description
    if (empty($desc)) {
        // Single posts, pages, and attachments
        if (is_singular()) {
            $post = get_post();
            if (empty($post)) {
                $desc = '';
            }
            $desc = wptexturize($post->post_content);
            // Get the entire contents, not the excerpt, so as to not duplicate Ubik Excerpt
        }
        // Check to see if we have a description for this category, tag, or taxonomy
        if (is_category() || is_tag() || is_tax()) {
            $desc = term_description();
        }
        // Now match other possibilities...
        if (is_author()) {
            $desc = get_the_author_meta('description');
        }
        // Front or home page
        if (is_front_page() || is_home()) {
            $desc = get_bloginfo('description');
        }
        // No excerpt to return
        if (is_404() || is_search()) {
            $desc = '';
        }
        $desc = ubik_seo_meta_description_sanitize($desc);
    }
    return apply_filters('ubik_seo_meta_description', $desc);
}
function woocommerce_category_archive_description()
{
    if (is_tax(array('product_cat', 'product_tag')) && get_query_var('paged') == 0) {
        $description = wc_format_content(term_description());
        $image = false;
        if (is_tax() || is_tag() || is_category()) {
            $term = get_queried_object();
            $thumbnail_id = absint(get_woocommerce_term_meta($term->term_id, 'thumbnail_id', true));
            if ($thumbnail_id) {
                $image = wp_get_attachment_image($thumbnail_id, 250);
            } else {
                $image = wc_placeholder_img_src();
            }
        }
        if ($description) {
            $string = '<div class="row margin-bottom">';
            if ($image) {
                $string .= '<div class="col-sm-4 col-sm-push-8">' . $image . '</div>';
            }
            $string .= '<div class="term-description col-sm-8';
            if ($image) {
                $string .= ' col-sm-pull-4';
            }
            $string .= '">' . $description . '</div></div>';
            echo $string;
        }
    }
}
function pods_tutorials_list($ids, $heading, $dashicon)
{
    //include only terms whose ids were set in $ids param
    $args = array('include' => $ids);
    //get the terms matching the args
    $terms = get_terms('tutorial_type', $args);
    //add underscores to $heading in separate var for ul id
    $name = str_replace(' ', '-', $heading);
    echo '<h3>' . $heading . '</h3>';
    echo '<ul id="tutorials-' . $name . '" class="tutorials-topics-list">';
    //loop through terms
    foreach ($terms as $term) {
        //get link, description and name for each term.
        $link = get_term_link($term);
        $description = term_description($term->term_id, 'tutorial_type');
        $name = $term->name;
        //create list item
        echo '<li><div class="dashicons ' . $dashicon . ' tutorial-term-dashicon"></div><div class="tutorial-term"><a href="' . $link . '">' . $name . '</a>';
        if (!empty($description)) {
            echo '<br /><span class="tutorial-term-description">' . strip_tags($description, '') . '</span>';
        }
        echo '</div></li>';
    }
    //endforeach
    echo '</ul>';
}
Ejemplo n.º 10
0
/**
 * Output description
 *
 * @return string $description
 */
function calibrefx_meta_description()
{
    global $post, $wp_query, $wp_locale;
    $desc = '';
    if (is_home() || is_front_page()) {
        $desc = get_bloginfo('description');
    } elseif (is_singular()) {
        $desc = calibrefx_truncate_phrase($post->post_content, calibrefx_get_option('content_archive_limit'));
    } elseif (is_archive()) {
        if (is_category()) {
            $desc = category_description(get_query_var('cat'));
        } elseif (is_tax()) {
            $term = $wp_query->get_queried_object();
            $desc = term_description($term->term_id, $term->taxonomy);
        } elseif (is_year()) {
            $desc = __('All posts in ', 'calibrefx') . get_query_var('year');
        } elseif (is_month()) {
            $desc = __('All Posts in ', 'calibrefx') . $wp_locale->get_month(get_query_var('monthnum')) . ' ' . get_query_var('year');
        } elseif (is_day()) {
            $desc = __('All Posts in ', 'calibrefx') . get_query_var('day') . ' ' . $wp_locale->get_month(get_query_var('monthnum')) . ' ' . get_query_var('year');
        } elseif (is_author()) {
            $desc = get_user_meta($wp_query->queried_object->ID, 'intro_text', true);
        } elseif (is_post_type_archive()) {
            $post_type = $wp_query->get_queried_object();
            $desc = $post_type->description;
        }
    } elseif (is_404()) {
        $desc = __('Page not found ', 'calibrefx');
    }
    $desc = str_replace(array('<p>', '</p>'), array('', ''), $desc);
    $desc = htmlentities($desc);
    return apply_filters('calibrefx_meta_description', $desc);
}
Ejemplo n.º 11
0
 function et_brand_description()
 {
     if (is_tax('brand') && term_description() != '') {
         echo '<div class="term-description">';
         echo term_description();
         echo '</div>';
     }
 }
Ejemplo n.º 12
0
 /**
  * Header data for header section
  *
  * @return array
  */
 public static function header_data()
 {
     $header_image = get_header_image();
     $page_layout_class = ' .page-layout-' . Model_Page_Layout_Settings::get_layout() . ' .page-layout-width-' . Model_Page_Layout_Settings::get_width() . ' .page-layout-sidebar-width-' . Model_Page_Layout_Settings::get_sidebar_width();
     $header = array('allowedtags' => $GLOBALS['allowedtags'], 'language_attributes' => get_language_attributes(), 'body_class' => implode(' ', get_body_class()) . $page_layout_class, 'charset' => get_bloginfo('charset'), 'ping_back_url' => get_bloginfo('pingback_url'), 'name' => get_bloginfo('name'), 'home_url' => esc_url(home_url('/')), 'description' => get_bloginfo('description'), 'favicon' => General_Site_Settings_Model::get_favicon(), 'touch_icon' => General_Site_Settings_Model::get_touch_icon(), 'custom_styles' => '', 'is_enabled_preloader' => Model_Logo_And_Favicon::is_enable_page_preloader(), 'logo' => General_Site_Settings_Model::get_logo(), 'socials' => View::make('blocks/socials', array('socials' => Social_Settings_Model::get_all_socials(), 'where' => 'header')), 'socials_show_header' => Social_Settings_Model::is_show_header(), 'disclimer' => Header_Settings_Model::get_disclimer(), 'search_box' => Header_Settings_Model::get_search_box(), 'header_style_layout' => Header_Settings_Model::get_header_style(), 'header_layout_view' => sprintf('header-%s', Header_Settings_Model::get_header_style()), 'header_image' => $header_image, 'header_slogan' => get_option('photolab_header_slogan'), 'header_class' => Header_Settings_Model::get_header_class(), 'static_class' => empty($header_image) ? 'static' : 'absolute', 'term_description' => term_description(), 'welcome_message' => get_option('photolab'), 'main_menu' => wp_nav_menu(array('theme_location' => 'main', 'container' => 'nav', 'container_class' => 'main-navigation', 'container_id' => 'site-navigation', 'menu_class' => 'sf-menu', 'walker' => new Photolab_Walker(), 'echo' => false)), 'top_menu' => wp_nav_menu(array('theme_location' => 'top', 'container' => 'nav', 'container_class' => 'top-navigation', 'container_id' => 'site-navigation', 'menu_class' => 'sf-top-menu', 'walker' => new Photolab_Walker(), 'echo' => false)));
     $header['alt_mess'] = Utils::array_get($header['welcome_message'], 'welcome_title', get_bloginfo('name'));
     return $header;
 }
 /**
  * Show an archive description on taxonomy archives
  *
  * @access public
  * @subpackage	Archives
  * @return void
  */
 function sportspress_taxonomy_archive_description()
 {
     if (is_tax(array('sp_season', 'sp_league', 'sp_venue', 'sp_position')) && get_query_var('paged') == 0) {
         $description = apply_filters('the_content', term_description());
         if ($description) {
             echo '<div class="term-description">' . $description . '</div>';
         }
     }
 }
Ejemplo n.º 14
0
/**
	*存档页信息
	*http://www.bgbk.org
*/
function Bing_archive_header()
{
    if (!is_archive()) {
        return;
    }
    if (is_author()) {
        $dashicons = 'admin-users';
        $name = $GLOBALS['authordata']->display_name;
        $description = get_the_author_meta('description');
        $feed_link = get_author_feed_link($GLOBALS['authordata']->ID);
    } elseif (is_date()) {
        $dashicons = 'calendar';
        if (is_day()) {
            $format = __('Y年m月d日', 'Bing');
        } elseif (is_month()) {
            $format = __('Y年m月', 'Bing');
        } else {
            $format = __('Y年', 'Bing');
        }
        $name = get_the_date($format);
        $description = sprintf(__('%s发布的文章', 'Bing'), $name);
    } else {
        $dashicons = is_tag() ? 'tag' : 'category';
        $name = single_term_title('', false);
        $description = term_description();
        $feed_link = get_term_feed_link(get_queried_object_id(), get_queried_object()->taxonomy);
    }
    $description = strip_tags($description);
    ?>
	<div class="span12 archive-header">
		<article class="panel">
			<header class="panel-header">
				<h3>
					<span class="dashicons dashicons-<?php 
    echo $dashicons;
    ?>
"></span><?php 
    echo $name;
    ?>
				</h3>
				<?php 
    if (Bing_mpanel('breadcrumbs')) {
        Bing_breadcrumbs('<span class="separator dashicons dashicons-arrow-right-alt2"></span>', '<span class="right breadcrumb"%s>', '</span>', '<span class="dashicons dashicons-admin-home"></span>' . __('首页', 'Bing'));
    }
    ?>
			</header>
			<?php 
    echo empty($description) ? __('无描述', 'Bing') : $description;
    if (!empty($feed_link)) {
        printf('<a href="%s" title="%s" class="feed-link"><span class="dashicons dashicons-rss"></span></a>', esc_url($feed_link), esc_attr(__('此存档的 Feed 源,可以使用 RSS 阅读器订阅这些内容', 'Bing')));
    }
    ?>
		</article>
	</div>
<?php 
}
 function recipe_hero_archive_tax_desc()
 {
     if (is_tax()) {
         $term_description = term_description();
         if (!empty($term_description)) {
             echo apply_filters('category_archive_meta', '<div class="taxonomy-description">' . $term_description . '</div>');
         }
         echo '</div><hr />';
     }
 }
Ejemplo n.º 16
0
 protected function import_wp_object($wp_term_id, $taxonomy)
 {
     $wp_term = get_term($wp_term_id, $taxonomy);
     $this->wp_term = $wp_term;
     $this->wp_id = $wp_term_id;
     $this->grape_href = get_term_meta($wp_term_id, '_grape_href', true);
     $this->grape_indexed = get_term_meta($wp_term_id, '_grape_indexed', true);
     $this->wp_type = $taxonomy;
     $this->url = '';
     $this->title = html_entity_decode(strip_tags(get_the_title($wp_term_id)));
     $this->description = term_description($wp_term_id, $taxonomy);
 }
 /**
  * Shim for `the_archive_description()`.
  *
  * Display category, tag, or term description.
  *
  * @todo Remove this function when WordPress 4.3 is released.
  *
  * @param string $before Optional. Content to prepend to the description. Default empty.
  * @param string $after  Optional. Content to append to the description. Default empty.
  */
 function the_archive_description($before = '', $after = '')
 {
     $description = apply_filters('get_the_archive_description', term_description());
     if (!empty($description)) {
         /**
          * Filter the archive description.
          *
          * @see term_description()
          *
          * @param string $description Archive description to be displayed.
          */
         echo $before . $description . $after;
     }
 }
Ejemplo n.º 18
0
 /**
  * Show an archive description on taxonomy archives.
  *
  * @subpackage	Archives
  */
 function woocommerce_taxonomy_archive_description()
 {
     if (is_tax(array('product_cat', 'product_tag')) && 0 === absint(get_query_var('paged'))) {
         $queried_object = get_queried_object();
         $taxonomy = $queried_object->taxonomy;
         $term_id = $queried_object->term_id;
         $soustitre = get_field('soustitre', $taxonomy . '_' . $term_id);
         echo '<h2 class="cat-soustitre">' . $soustitre . '</h2>';
         $description = wc_format_content(term_description());
         if ($description) {
             echo '<div class="term-description">' . $description . '</div>';
         }
     }
 }
Ejemplo n.º 19
0
 /**
  * Set meta description based on template.
  */
 function seo_description()
 {
     if (get_post_type(array('post', 'page', 'product'))) {
         $description = get_post_meta(get_the_ID(), '_fathom_seo_description', true);
         if ($description == '') {
             $description = get_excerpt_by_id(get_the_ID());
         }
     } elseif (is_product_category()) {
         global $wp_query;
         $cat_id = $wp_query->get_queried_object_id();
         $description = single_term_title() . ' - ' . strip_tags(term_description($cat_id, 'product_cat'));
     }
     // fallback
     if (!isset($description) || $description == '') {
         $description = get_bloginfo('description');
     }
     return esc_attr($description);
 }
Ejemplo n.º 20
0
function mota($name)
{
    global $post;
    $attribute_name = 'pa_' . $name;
    //array( 'pa_nhan-hieu', 'pa_kich-co' ,  ); // Insert attribute names here
    //foreach ( $attribute_names as $attribute_name ) {
    $taxonomy = get_taxonomy($attribute_name);
    if ($taxonomy && !is_wp_error($taxonomy)) {
        $terms = wp_get_post_terms($post->ID, $attribute_name);
        $terms_array = array();
        if (!empty($terms)) {
            foreach ($terms as $term) {
                $archive_link = get_term_link($term->slug, $attribute_name);
                /*$full_line = '<a class="name-attr" href="' . $archive_link . '">'. $term->name . '</a>';*/
                $intro = term_description($term->term_id, $attribute_name);
                $out = '<div class="intro-attr">' . $intro . "</div>";
                array_push($terms_array, $out);
            }
            return implode($terms_array, ', ');
        }
    }
    //}
}
Ejemplo n.º 21
0
if (have_posts()) {
    ?>

				<header class="archive-header">
					<h1 class="archive-title"><?php 
    printf(__('Category Events: %s', 'unyson'), single_cat_title('', false));
    ?>
</h1>
					<?php 
    if (function_exists('fw_ext_breadcrumbs')) {
        fw_ext_breadcrumbs();
    }
    ?>
					<?php 
    // Show an optional term description.
    $term_description = term_description();
    if (!empty($term_description)) {
        printf('<div class="taxonomy-description">%s</div>', $term_description);
    }
    ?>
				</header>

				<?php 
    // Start the Loop.
    while (have_posts()) {
        the_post();
        /*
         * Include the post format-specific template for the content. If you want to
         * use this in a child theme, then include a file called called content-___.php
         * (where ___ is the post format) and that will be used instead.
         */
Ejemplo n.º 22
0
 function woocommerce_taxonomy_archive_description()
 {
     if (is_tax(array('product_cat', 'product_tag')) && get_query_var('paged') == 0) {
         $description = apply_filters('the_content', term_description());
         if ($description) {
             echo '<div class="term-description container">' . $description . '</div>';
         }
     }
 }
			<div class='container'>

				<main class='template-page template-portfolio content  <?php 
avia_layout_class('content');
?>
 units' <?php 
avia_markup_helper(array('context' => 'content', 'post_type' => 'portfolio'));
?>
>

                    <div class="entry-content-wrapper clearfix">

                        <div class="category-term-description">
                            <?php 
echo term_description();
?>
                        </div>

                    <?php 
$grid = new avia_post_grid(array('linking' => '', 'columns' => '3', 'contents' => 'title', 'sort' => 'no', 'paginate' => 'yes', 'set_breadcrumb' => false));
$grid->use_global_query();
echo $grid->html();
?>
                    </div>

                <!--end content-->
                </main>
				<?php 
//get the sidebar
$avia_config['currently_viewing'] = 'portfolio';
    function woocommerce_content()
    {
        if (is_singular('product')) {
            while (have_posts()) {
                the_post();
                woocommerce_get_template_part('content', 'single-product');
            }
        } else {
            ?>
<h1 class="page-title">
				<?php 
            if (is_search()) {
                ?>
					<?php 
                printf(__('Search Results: &ldquo;%s&rdquo;', 'woocommerce'), get_search_query());
                ?>
				<?php 
            } elseif (is_tax()) {
                ?>
					<?php 
                echo single_term_title("", false);
                ?>
				<?php 
            } else {
                ?>
					<?php 
                $shop_page = get_post(woocommerce_get_page_id('shop'));
                echo apply_filters('the_title', ($shop_page_title = get_option('woocommerce_shop_page_title')) ? $shop_page_title : $shop_page->post_title);
                ?>
				<?php 
            }
            ?>
				
				<?php 
            if (get_query_var('paged')) {
                ?>
					<?php 
                printf(__('&nbsp;&ndash; Page %s', 'woocommerce'), get_query_var('paged'));
                ?>
				<?php 
            }
            ?>
			</h1>
					
			<?php 
            if (is_tax()) {
                ?>
				<?php 
                echo '<div class="term-description">' . wpautop(wptexturize(term_description())) . '</div>';
                ?>
			<?php 
            } elseif (!is_search() && !empty($shop_page) && is_object($shop_page)) {
                ?>
				<?php 
                echo '<div class="page-description">' . apply_filters('the_content', $shop_page->post_content) . '</div>';
                ?>
			<?php 
            }
            ?>
			
			<?php 
            if (have_posts()) {
                ?>
			
				<?php 
                do_action('woocommerce_before_shop_loop');
                ?>
			
				<ul class="products">
				
					<?php 
                woocommerce_product_subcategories();
                ?>
			
					<?php 
                while (have_posts()) {
                    the_post();
                    ?>
			
						<?php 
                    woocommerce_get_template_part('content', 'product');
                    ?>
			
					<?php 
                }
                // end of the loop.
                ?>
					
				</ul>
	
				<?php 
                do_action('woocommerce_after_shop_loop');
                ?>
			
			<?php 
            } else {
                ?>
			
				<?php 
                if (!woocommerce_product_subcategories(array('before' => '<ul class="products">', 'after' => '</ul>'))) {
                    ?>
						
					<p><?php 
                    _e('No products found which match your selection.', 'woocommerce');
                    ?>
</p>
						
				<?php 
                }
                ?>
			
			<?php 
            }
            ?>
			
			<div class="clear"></div>
				
			<?php 
            do_action('woocommerce_pagination');
        }
    }
Ejemplo n.º 25
0
 function woo_archive_description($echo = true)
 {
     do_action('woo_archive_description');
     // Archive Description, if one is available.
     $term_obj = get_queried_object();
     $description = term_description($term_obj->term_id, $term_obj->taxonomy);
     if ($description != '') {
         // Allow child themes/plugins to filter here ( 1: text in DIV and paragraph, 2: term object )
         $description = apply_filters('woo_archive_description', '<div class="archive-description">' . $description . '</div><!--/.archive-description-->', $term_obj);
     }
     if ($echo != true) {
         return $description;
     }
     echo $description;
 }
Ejemplo n.º 26
0
    public function widget($args, $instance)
    {
        extract($args);
        $product_alignment = $instance['product_alignment'];
        $product_category = $instance['product_category'];
        $product_args = array('post_type' => 'product', 'tax_query' => array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => $product_category)), 'posts_per_page' => '6');
        ?>
        <section class="category_product">
            <div class="ak-container">
                <?php 
        echo $before_widget;
        ?>
                <div class="feature-cat-product-wrap">
                <?php 
        //if($product_alignment == 'left_align'):
        ?>
                    <div class="feature-cat-image <?php 
        echo $product_alignment;
        ?>
">
                        <?php 
        $thumbnail_id = get_woocommerce_term_meta($product_category, 'thumbnail_id', true);
        if (!empty($thumbnail_id)) {
            $image = wp_get_attachment_image_src($thumbnail_id, 'prod-cat-size');
            echo '<img src="' . esc_url($image[0]) . '" alt="asfds"  />';
        } else {
            ?>
                        <img src="<?php 
            echo get_template_directory_uri() . '../images/dummy-cat.jpg';
            ?>
"/>
                        <?php 
        }
        ?>
                        <div class="product-cat-desc">
                            <?php 
        $taxonomy = 'product_cat';
        $terms = term_description($product_category, $taxonomy);
        $terms_name = get_term($product_category, $taxonomy);
        ?>
                            <h3><?php 
        echo $terms_name->name;
        ?>
</h3>
                            <div class="cat_desc">  
                            <?php 
        echo $terms;
        ?>
   
                            </div>  
                        </div>
                    </div>
                <?php 
        //endif;
        ?>
                    <div class="feature-cat-product <?php 
        echo $product_alignment;
        ?>
">
                        <?php 
        $prod_args = array('post_type' => 'product', 'tax_query' => array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => $product_category)), 'posts_per_page' => '6');
        $product_query = new WP_Query($prod_args);
        if ($product_query->have_posts()) {
            $count = 1;
            while ($product_query->have_posts()) {
                $product_query->the_post();
                $image_id = get_post_thumbnail_id();
                $image = wp_get_attachment_image_src($image_id, 'thumbnail', 'true');
                ?>
                                        <div class="feature-prod-wrap wow flipInY" data-wow-delay="<?php 
                echo $count;
                ?>
s">
                                            <?php 
                woocommerce_get_template_part('content', 'feat-product');
                ?>
                                        </div>
                                    <?php 
                $count += 0.5;
            }
        }
        ?>
                    </div>
                    
                    <?php 
        /*($product_alignment == 'right_align'): ?>
              <div class="feature-cat-image">
                  <?php 
                  $thumbnail_id = get_woocommerce_term_meta($product_category, 'thumbnail_id', true);
                  if (!empty($thumbnail_id)) {
                      $image = wp_get_attachment_image_src($thumbnail_id, 'prod-cat-size');
                      echo '<img src="' . esc_url($image[0]) . '" alt="asfds"  />';
                  }
                  else{ ?>
                  <img src="<?php echo get_template_directory_uri().'../images/dummy-cat.jpg'?>"/><?php } ?>
                  <div class="product-cat-desc">
                      <?php 
                      
                      $taxonomy = 'product_cat';
                      $terms = term_description( $product_category, $taxonomy ); 
                       $terms_name = get_term( $product_category, $taxonomy );
                      ?>
                      <h3><?php echo $terms_name->name ?></h3>
                      <div class="cat_desc">  
                      <?php echo $terms; ?>   
                      </div>     
                  </div>
              </div>
          <?php endif; */
        ?>
                    
                </div>
                
                
                
                <?php 
        echo $after_widget;
        ?>
            </div>
        </section>
        <?php 
    }
/**
 * Retrieve tag description.
 *
 * @since 2.8.0
 *
 * @param int $tag Optional. Tag ID. Will use global tag ID by default.
 * @return string Tag description, available.
 */
function tag_description($tag = 0)
{
    return term_description($tag);
}
Ejemplo n.º 28
0
/**
 * Retrieve category, tag, or term description.
 *
 * @since 4.1.0
 *
 * @return string Archive description.
 */
function get_the_archive_description()
{
    /**
     * Filter the archive description.
     *
     * @since 4.1.0
     *
     * @see term_description()
     *
     * @param string $description Archive description to be displayed.
     */
    return apply_filters('get_the_archive_description', term_description());
}
 /**
  * Show an archive description on taxonomy archives
  *
  * @access public
  * @subpackage	Archives
  * @return void
  */
 function woocommerce_taxonomy_archive_description()
 {
     if (is_tax(array('product_cat', 'product_tag')) && get_query_var('paged') == 0) {
         $description = wpautop(do_shortcode(term_description()));
         if ($description) {
             echo '<div class="term-description">' . $description . '</div>';
         }
     }
 }
Ejemplo n.º 30
-1
/**
 * Archive description wrap open
 * Checks if the shop page has content, or the term (category, tag etc) has content before displaying a wrap opener.
 * Hooked into: woocommerce_archive_description()
 */
function woo_wc_archive_description_wrap_close()
{
    $page_id = get_option('woocommerce_shop_page_id');
    $page_object = get_page($page_id);
    if (is_shop() && $page_object->post_content != '') {
        $description = true;
    } elseif (!is_shop()) {
        $term_obj = get_queried_object();
        $description = term_description($term_obj->term_id, $term_obj->taxonomy);
    } else {
        $description = '';
    }
    if ($description != '') {
        ?>
		</div>
	<?php 
    }
}