function c_list_desc($post_id = null, $shortdesc = null)
{
    if ($shortdesc == '') {
        $shortdesc = strip_tags(get_product_short_description($post_id));
    }
    //remove all shortcodes - discsox
    $shortdesc = trim(strip_shortcodes($shortdesc));
    $desclenght = strlen($shortdesc);
    $more = '';
    $limit = apply_filters('c_list_desc_limit', 243);
    if ($desclenght > $limit) {
        $more = ' [...]';
    }
    return apply_filters('c_list_desc_content', substr($shortdesc, 0, $limit) . $more, $post_id);
}
Example #2
0
/**
 * Checks if product has short description
 *
 * @param int $product_id
 * @return boolean
 */
function has_product_short_description($product_id)
{
    $desc = get_product_short_description($product_id);
    if (!empty($desc)) {
        return true;
    } else {
        return false;
    }
}
Example #3
0
/**
 * Shows product short description
 *
 * @param type $atts
 * @return string
 */
function ic_product_short_description($atts)
{
    $args = shortcode_atts(array('product' => get_the_ID()), $atts);
    $shortdesc = get_product_short_description($args['product']);
    return apply_filters('product_short_description', $shortdesc);
}
function show_short_desc($post, $single_names)
{
    $shortdesc = get_product_short_description($post->ID);
    ?>
	<div class="shortdesc">
		<?php 
    echo apply_filters('product_short_description', $shortdesc);
    ?>
	</div>
	<?php 
}
function simple_prepare_products_to_export()
{
    $products = simple_get_all_exported_products();
    $fields = array();
    $fields[1]['image_url'] = __('Image URL', 'al-product-csv');
    $fields[1]['product_name'] = __('Product Name', 'al-product-csv');
    $fields[1]['product_price'] = __('Product Price', 'al-product-csv');
    $fields[1]['product_categories'] = __('Product Categories', 'al-product-csv');
    $fields[1]['product_short_desc'] = __('Short Description', 'al-product-csv');
    $fields[1]['product_desc'] = __('Long Description', 'al-product-csv');
    $z = 2;
    foreach ($products as $product) {
        $image = wp_get_attachment_image_src(get_post_thumbnail_id($product->ID), 'full');
        $desc = get_product_description($product->ID);
        $short_desc = get_product_short_description($product->ID);
        $fields[$z]['image_url'] = $image[0];
        $fields[$z]['product_name'] = $product->post_title;
        $fields[$z]['product_price'] = get_post_meta($product->ID, '_price', true);
        $category_array = get_the_terms($product->ID, 'al_product-cat');
        $category = array();
        if (!empty($category_array)) {
            foreach ($category_array as $p_cat) {
                $value = html_entity_decode($p_cat->name);
                $category[] = $value;
            }
        }
        $fields[$z]['product_categories'] = implode(' | ', $category);
        $fields[$z]['product_short_desc'] = $short_desc;
        $fields[$z]['product_desc'] = $desc;
        $z++;
    }
    return array_filter($fields);
}
function al_product_short_desc()
{
    global $post;
    echo '<input type="hidden" name="shortdescmeta_noncename" id="shortdescmeta_noncename" value="' . wp_create_nonce(plugin_basename(__FILE__)) . '" />';
    $shortdesc = get_product_short_description($post->ID);
    $short_desc_settings = array('media_buttons' => false, 'textarea_rows' => 5, 'tinymce' => array('menubar' => false, 'toolbar1' => 'bold,italic,underline,blockquote,strikethrough,bullist,numlist,alignleft,aligncenter,alignright,undo,redo,link,unlink,fullscreen', 'toolbar2' => '', 'toolbar3' => '', 'toolbar4' => ''));
    wp_editor($shortdesc, 'excerpt', $short_desc_settings);
}
<?php

if (!defined('ABSPATH')) {
    exit;
    // Exit if accessed directly
}
/**
 * The template to display product short description on product page or with a shortcode
 *
 * Copy it to your theme implecode folder to edit the output: your-theme-folder-name/implecode/product-short-description.php
 *
 * @version		1.1.2
 * @package		ecommerce-product-catalog/templates/template-parts/product-page
 * @author 		Norbert Dreszer
 */
$product_id = ic_get_product_id();
$shortdesc = get_product_short_description($product_id);
?>

<div class="shortdesc">
	<?php 
echo apply_filters('product_short_description', $shortdesc);
?>
</div>

Example #8
0
/**
 * Returns short description text without HTML
 *
 * @param int $product_id
 * @return string
 */
function clean_short_description($product_id, $new_line = ' ')
{
    $shortdesc = get_product_short_description($product_id);
    $shortdesc = strip_tags($shortdesc);
    $shortdesc = trim(strip_shortcodes($shortdesc));
    $shortdesc = str_replace(array("\r\n"), $new_line, $shortdesc);
    return $shortdesc;
}