New Landing How can we help? Themeforest Theme Support Dante Use custom excerpt else where

Viewing 15 posts - 1 through 15 (of 21 total)
  • Posted in: Dante
  • #54437
    parcyvall
    Member
    Post count: 143

    Hi Support,

    I use a PHP Widget to display post Info in the sidebar. It’s easy to reference the post excerpt but as there is a custom excerpt which is used on the blog and category page I would love to use that instead.

    What function do I need to add to the Widget to reference the custom excerpt for the current post?

    (For the “normal” excerpt the code is <?php the_excerpt(); ?> )

    Kind regards
    Simon

    #54454
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Which widget is used by at sidebar ? Please attach some screenshot so i can get exactly .
    Thanks

    #54455
    parcyvall
    Member
    Post count: 143
    This reply has been marked as private.
    #54466
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    HI,
    Please use code like that

    <?php 
    global $post; $postID = $post->ID
    echo $custom_excerpt = get_post_meta($postID, 'sf_custom_excerpt', true);
    ?>
    #54508
    parcyvall
    Member
    Post count: 143

    Hi,

    the code returns the following error:

    Parse error: syntax error, unexpected ‘echo’ (T_ECHO) in /mounted-storage/home159/sub021/sc84799-QMXY/parcyvall.com/2014/wp-content/plugins/php-text-widget/plugin.php(18) : eval()’d code on line 3

    I tried several methods of loading the code, so it might be a problem with the code. Could you help with that?

    Kind regards
    Simon

    #54512
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please use this one ,i missed closing statement .

    <?php 
    global $post; $postID = $post->ID;
    echo $custom_excerpt = get_post_meta($postID, 'sf_custom_excerpt', true);
    ?>
    #54515
    parcyvall
    Member
    Post count: 143

    Works great. Thanks for your time!

    kind regards
    Simon

    #54518
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Thanks Mohammad!

    – Kyle

    #54520
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    You most welcome .
    Cheers! 😀
    With Best Regards
    Swift Ideas

    #54629
    parcyvall
    Member
    Post count: 143

    Sorry to bother you again.

    I would like to use the Thumbnail Image in the same Widget, again it’s quite easy to get the regular Featured Image but I don’t know the Swiftframework-Code.

    Could you help with that?

    Kind regards
    Simon

    #54715
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    HI,
    You can use regular Featured Image . It will work 100% sure .

    Thanks

    #54763
    parcyvall
    Member
    Post count: 143

    Hi,

    When I try to get the SF-Thumbnail with the regular wordpress-code for Featured Image <?php the_post_thumbnail( $size, $attr ); ?> it get’s me the standard Featured Image (or nothing if none is set) and not the SF-Thumbnail.

    To show you which thumbnail I mean, I attached a screenshot.

    Kind regards
    Simon

    #54778
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please code like that

    global $post;
    $postID = $post->ID;
    $media_width  = 150;
    $media_height = 150;
    $use_thumb_content= false;
    echo sf_image_post($postID, $media_width, $media_height,$use_thumb_content);

    Thanks

    #54799
    parcyvall
    Member
    Post count: 143

    Hi, two problems with that.
    1. This loads a seemingly random image I used a couple revisions ago. But have since exchanged.
    2. The Image is square (because of media_width and media_height). I need the image aspect ratio to be responsive to the Image dimensions so that a horizontal image stays horizontal etc.

    #54817
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please try this code

    $media_image = get_post_thumbnail_id();
    if ($media_image) {
    $image_id = $media_image;
    $media_image_url = wp_get_attachment_url( $media_image, 'full' );
    $detail_image = aq_resize( $media_image_url, 150,150, true, false);// you can change 150 to any height and width 
    if ($detail_image) {
    $image = '<img itemprop="image" src="'.$detail_image[0].'" width="'.$detail_image[1].'" height="'.$detail_image[2].'" alt="'.$image_alt.'" />';
    }
    echo $image;
    }

    Thanks

Viewing 15 posts - 1 through 15 (of 21 total)

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

License required for one of the following items
Login and Registration Log in · Register