- Deprecated: Function get_magic_quotes_gpc() is deprecated in /var/html/dev/wp/wp-includes/formatting.php on line 4371Deprecated: Function get_magic_quotes_gpc() is deprecated in /var/html/dev/wp/wp-includes/formatting.php on line 4371Notice: Trying to get property 'comment_author_email' of non-object in /var/html/dev/wp/wp-content/plugins/fv-gravatar-cache/fv-gravatar-cache.php on line 236
mark9
MemberWarning: Cannot modify header information - headers already sent by (output started at /var/html/dev/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php:340) in /var/html/dev/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_wp.class.php on line 220I posted first about this in “How to Customize the Theme’s Content Area” topic but then realised it would be more helpful it separately.
I really appreciate Daniel’s help, he’s been so helpful! Here is a copy of my first two posts in that original topic:mark9
Hi Daniel,
I have my posts displayed in 4 columns. Everything looks great, am really happy with your theme. Just one thing I can not resolve and wonder if there are any options available to make it to work. I constantly use shortcodes in my posts [like for example a shortcode for a Like/Dislike button]. In posts excerpts all shortcodes are ignored. Is it be possible for them to be recognised somehow?
Thanks in advance.
MarkDaniel Tara
Add this to your functions.php file:
add_filter( ‘the_excerpt’, ‘do_shortcode’ );mark9
Daniel, I can’t even tell you how impressed I’m with your products and with the way you conduct you business. I’ve tried more than 20 different themes and honestly, I wouldn’t put them even close [even deactivated] to your one. Then you replied just few hours after I submitted my question! What can I say – top notch stuff!
Man, it didn’t work. Unfortunately.
It still ignores my shortcodes. I use 2 of them – one for a table from Tablepress and one for Like buttons from Likebtn.
I put that line you recommended right below this [at the very bottom of functions.php]:
if ( ! function_exists( ‘pinboard_copyright_notice’ ) ) :
/**
* Display notification no posts were found
*
* @since Pinboard 1.0
*/
function pinboard_copyright_notice() {
$copyright = pinboard_get_option( ‘copyright_notice’ );
$copyright = str_replace( ‘%year%’, date( ‘Y’ ), $copyright );
$copyright = str_replace( ‘%blogname%’, get_bloginfo( ‘name’ ), $copyright );
echo esc_html( $copyright );
}
endif;
Thanks a zillion!
MarkDaniel Tara
You are probably not using a custom excerpt but have it generated automatically. In this case shortcodes are stripped automatically by WordPress. You can either add a custom excerpt for each post or add this code in functions.php:
remove_filter( ‘get_the_excerpt’, ‘wp_trim_excerpt’ );
add_filter( ‘get_the_excerpt’, ‘pinboard_trim_excerpt’ );function pinboard_trim_excerpt($text = ”) {
$raw_excerpt = $text;
if ( ” == $text ) {
$text = get_the_content(”);$text = apply_filters(‘the_content’, $text);
$text = str_replace(‘]]>’, ‘]]>’, $text);
$excerpt_length = apply_filters(‘excerpt_length’, 55);
$excerpt_more = apply_filters(‘excerpt_more’, ‘ ‘ . ‘[…]’);
$text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
}
return apply_filters(‘wp_trim_excerpt’, $text, $raw_excerpt);
}AdvertismentDeprecated: Function get_magic_quotes_gpc() is deprecated in /var/html/dev/wp/wp-includes/formatting.php on line 4371Deprecated: Function get_magic_quotes_gpc() is deprecated in /var/html/dev/wp/wp-includes/formatting.php on line 4371Notice: Trying to get property 'comment_author_email' of non-object in /var/html/dev/wp/wp-content/plugins/fv-gravatar-cache/fv-gravatar-cache.php on line 236mark9
MemberWarning: Cannot modify header information - headers already sent by (output started at /var/html/dev/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php:340) in /var/html/dev/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_wp.class.php on line 220My last post in that original topic before starting posting in this one.
Mark9
Thanks a lot Daniel. You are soooo helpful! I thought it would more beneficial to have it as a separate topic, so I’ve just moved our conversation toTill today I knew nothing about custom excerpt, functions.php and all other things. Didn’t even know that WP
1] strips out all HTML and images
2] truncates your post to 55 words
3] adds this to the end of the text: “[…]“[the first item is my main problem, isn’t it?] I don’t know PHP and HTML but have just started educating myself with what is a a custom excerpt and how to create it.
I put in functions.php your recommended code, now I can see the text inside those shortcodes published but they are not read as HTML commands.
🙁
Back to my topicDeprecated: Function get_magic_quotes_gpc() is deprecated in /var/html/dev/wp/wp-includes/formatting.php on line 4371Deprecated: Function get_magic_quotes_gpc() is deprecated in /var/html/dev/wp/wp-includes/formatting.php on line 4371Notice: Trying to get property 'comment_author_email' of non-object in /var/html/dev/wp/wp-content/plugins/fv-gravatar-cache/fv-gravatar-cache.php on line 236mark9
MemberWarning: Cannot modify header information - headers already sent by (output started at /var/html/dev/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php:340) in /var/html/dev/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_wp.class.php on line 220I came across an interesting article about WordPress Post Excerpts
Daniel, can your additional code fix the 55 words thing and “[…]“? To make it unlimited in length and no “[…]“. But the main thing of course – to make it to read HTMLs
May be there is a plugin that can do this?
That article above says:
“In the theme, theme developers have access to the the_excerpt() template tag. If you have filled in the excerpt box, WP displays your custom excerpt”
Can not say I know what that means but your extra code did just that, isn’t it?Thanks a lot for your time! To say that you are the best – that not to say anything.
Kind Regards,
Mark
Deprecated: Function get_magic_quotes_gpc() is deprecated in /var/html/dev/wp/wp-includes/formatting.php on line 4371Deprecated: Function get_magic_quotes_gpc() is deprecated in /var/html/dev/wp/wp-includes/formatting.php on line 4371Notice: Trying to get property 'comment_author_email' of non-object in /var/html/dev/wp/wp-content/plugins/fv-gravatar-cache/fv-gravatar-cache.php on line 236Daniel Tara
KeymasterNotice: Undefined offset: 0 in /var/html/dev/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 532Fatal error: Uncaught Error: Call to a member function id() on array in /var/html/dev/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php:36 Stack trace: #0 /var/html/dev/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php(538): CrayonFormatter::format_code('', Array, Object(CrayonHighlighter)) #1 [internal function]: CrayonFormatter::delim_to_internal(Array) #2 /var/html/dev/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php(516): preg_replace_callback('#()#msi', 'CrayonFormatter...', 'add_filter( \xE2\x80\x98...') #3 /var/html/dev/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_highlighter.class.php(166): CrayonFormatter::format_mixed_code('add_filter( \xE2\x80\x98...', Object(CrayonLang), Object(CrayonHighlighter)) #4 /var/html/dev/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_highlighter.class.php(186): CrayonHighlighter->process() #5 /var/html/dev/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_wp.class.php(213): CrayonHighli in /var/html/dev/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 36