Digital experiences for all disciplines
New Landing › How can we help? › Themeforest Theme Support › Dante › Use custom excerpt else where
New Landing › How can we help? › Themeforest Theme Support › Dante › Use custom excerpt else where
- This topic has 20 replies, 3 voices, and was last updated 10 years by Kyle – SUPPORT.
-
Posted in: Dante
-
March 5, 2014 at 11:28 am #54437
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
SimonMarch 5, 2014 at 11:59 am #54454Hi,
Which widget is used by at sidebar ? Please attach some screenshot so i can get exactly .
ThanksMarch 5, 2014 at 12:08 pm #54455This reply has been marked as private.March 5, 2014 at 12:27 pm #54466HI,
Please use code like that<?php global $post; $postID = $post->ID echo $custom_excerpt = get_post_meta($postID, 'sf_custom_excerpt', true); ?>
March 5, 2014 at 1:47 pm #54508Hi,
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
SimonMarch 5, 2014 at 2:06 pm #54512Hi,
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); ?>
March 5, 2014 at 2:09 pm #54515Works great. Thanks for your time!
kind regards
SimonMarch 5, 2014 at 2:19 pm #54518Thanks Mohammad!
– Kyle
March 5, 2014 at 2:22 pm #54520Hi,
You most welcome .
Cheers! 😀
With Best Regards
Swift IdeasMarch 5, 2014 at 5:06 pm #54629Sorry 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
SimonMarch 6, 2014 at 1:20 am #54715HI,
You can use regular Featured Image . It will work 100% sure .Thanks
March 6, 2014 at 8:56 am #54763Hi,
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
SimonMarch 6, 2014 at 9:11 am #54778Hi,
Please code like thatglobal $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
March 6, 2014 at 9:30 am #54799Hi, 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.March 6, 2014 at 9:44 am #54817Hi,
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
-
Posted in: Dante
You must be logged in and have valid license to reply to this topic.