New Landing How can we help? Themeforest Theme Support Dante how to get short description with a snippet

Viewing 10 posts - 16 through 25 (of 25 total)
  • Posted in: Dante
  • #121306
    alemarengo
    Member
    Post count: 695

    Hi Mohammad.
    Plugin code is located at the quite bottom of the functions.php file, dante-child theme.
    I’d like to display Short Description, the one you can write once you click on Meta Options tab>Product Meta>Product short description, first text field.
    Not the second one, which is for long description and I left blank.

    Attachments:
    You must be logged in to view attached files.
    #121309
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    In which url will you check this short description? Actually i am testing so where to check this?
    Thanks
    Mohammad

    #121310
    alemarengo
    Member
    Post count: 695
    This reply has been marked as private.
    #121311
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    You just completed your question so i just resolved it so please check it now.
    Code Used:-

    function lw_woocommerce_gpf_description( $description, $ID ) {
        $product_description = sf_get_post_meta($ID, 'sf_product_short_description', true);
        return $product_description;
    }
    add_filter( 'woocommerce_gpf_description', 'lw_woocommerce_gpf_description', 10, 2 );

    Thanks
    Mohammad

    #121315
    alemarengo
    Member
    Post count: 695

    Hi Mohammad!
    I’m testing right now.
    It seems quite working, but not fully. In fact, the provided url retrieves broken data.
    Is there a way to put $product_description within the plugin’s snippet?
    Now it seems that description will be added in a separate way. ๐Ÿ™
    I’ll forward this to plugin’s developer and let you know! ๐Ÿ™‚

    #121316
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Dont worry. I just solved it. Just say and we are here to help.
    Thanks
    Mohammad

    #139270
    alemarengo
    Member
    Post count: 695

    Sorry for delay!
    To whoever may need this kind of info, especially who purchased and use Google Product Feed, I solved that with the following snippet in functions.php:

    function lw_woocommerce_gpf_description( $description, $ID ) {
    $product_description = strip_tags ( sf_get_post_meta($ID, 'sf_product_short_description', true) );
    if ( $product_description ) {
    $desc = $product_description;
    } else {
    $desc = get_the_title( $ID );
    }
    return $desc;
    }
    add_filter( 'woocommerce_gpf_description', 'lw_woocommerce_gpf_description', 10, 2 );
    #139273
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    I am glad that you managed to resolve the issue. Thanks for sharing the script.
    Thanks
    Mohammad

    #147699
    alemarengo
    Member
    Post count: 695

    Hi guys!
    Sorry to bother you.
    I know this topic has been marked as closed, but I’d like you to help me with the following:
    $product_description = sf_get_post_meta($post->ID, 'sf_product_description', true);
    conflicts or gets in trouble with another snippet that points to $post->ID.
    Conflict generates when trying to inject a shortcode within the_content throught snippet in a group of specific posts.
    My question is: is there another way to retrieve (short) description or to point out an array of posts? I have to do one of these two without using the same $post->ID method. Can you help me with a useful hint?
    I hope so, guys! .)

    #147745
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    There is no another way to o retrieve (short) description.
    Thanks
    Mohammad

Viewing 10 posts - 16 through 25 (of 25 total)

You must be logged in and have valid license to reply to this topic.

License required for the following item
Login and Registration Log in · Register