New answers tagged

1

Suppose you haven't modified anything to change the default content output, maybe this can help: add_filter('the_content', function($content) { $content = preg_replace('~^<p><img([^>]+)></p>~i', '', $content, 1); return $content; }, PHP_INT_MAX);


2

Instead of using the global variables directly, here's a way to use the content_pagination filter to add custom HTML to the last content page: /** * Append HTML to the last content page, if it's paginated */ add_filter( 'content_pagination', function( $pages ) { if( count( $pages ) > 1 ) $pages[count($pages)-1] .= '<div>MY HTML HERE!&...


0

This is working for me $shortcode = 'book'; $pattern = get_shortcode_regex(); // if shortcode 'book' exists if ( preg_match_all( '/'. $pattern .'/s', $post->post_content, $matches ) && array_key_exists( 2, $matches ) && in_array( $shortcode, $matches[2] ) ) { $shortcode_atts = array_keys($matches[2], $shortcode); // ...


1

How do the websites that are well optimized for sharing and excerpt displays are handling this subject ? They definitely have separate fields for excerpt / share-text etc. This is the only way to be certain what text gets used. These sites also make use of special meta tags in the head to send Facebook, Twitter et al. information about the content that ...


0

What's in your Apache logs? Maybe more info about the error. Set a 755 permission on the the public_html directory Who's your hosting provider? The issue might be permissions that you, as a user, cannot change yourself (contact hosting support).


0

Ok, I've found the answer myself through a lot of Googling :) If anyone else is struggling, this pastebin provides a solid solution for stripping out headings from the excerpts. The solution was provided by Michael at the Wordpress Support Forum.



Top 50 recent answers are included