Gallery stripped from excerpt of post

Your theme most likely uses the_excerpt() function. This function takes the post content and removes all formatting and shortcodes (including the shortcode), and truncates it to a certain amount of characters. What you could try is removing this function, and replacing it with the_content(), which still respects the <!– more –> tag in posts, but … Read more

automatic title through filter

I don’t understand why your “titles” are in the post body content, but you should not be echoing content from that filter. You should be creating and returning a string. function auto_dummy_titles($content) { if (strpos($content,'<h1>’) === false) { $content=”<h1>PLEASE ADD H1 TITLE TO THE PAGE</h1>”.$content; } return $content; } add_filter( ‘the_content’, ‘auto_dummy_titles’); The function does … Read more

How to disable a wp filter in a certain admin panel page

This should work, I guess: function my_init() { global $pagenow; if ( is_admin() && $pagenow != ‘edit-tags.php’ ) { add_filter( ‘image_send_to_editor’, ‘html5_insert_image’, 10, 9 ); } } add_action(‘init’, ‘my_init’); There is also get_current_screen function, which will be perfect here, but… You can use it after admin_init hook, and your image_send_to_editor is called earlier, I guess.

alternative to the_content filter

In functions.php: function myExcerpt($text) { $text = str_replace(‘]]>’, ‘]]&gt;’, $text); $text = strip_tags($text); $excerpt_length = 50; // max number of words $words = explode(‘ ‘, $text, $excerpt_length + 1); array_pop($words); array_push($words, ‘-N’); $text = implode(‘ ‘, $words); return $text; } In your loops: echo myExcerpt ( get_the_content() );

arguments for comment_notification_text filter

For the arguments, check the source: $notify_message = apply_filters( ‘comment_notification_text’, $notify_message, $comment_id ); You have two parameters. The first is the notification text itself, prior modification by your filter. It is constructed earlier in the same function and is different for comments, trackbacks, and pingbacks. The second parameter, as you might guess from the name, … Read more

Plugin default settings hook

I’d use a filter. You can remove this: if (function_exists(‘bf_new_defaults’)) { return bf_new_defaults( $default_settings ); } else { return $default_settings; } and replace it with something like this: return apply_filters(‘bf_filter’, $default_settings) The following is a truncated, proof of concept version of the code so you can see how $default_settings gets altered. add_filter( ‘bf_filter’, function($default_settings) { … Read more

Add Filter – Pass Variable (PHP < 5.3)

You could try something like the second option, but I think it would be overkill. Instead, just write your own custom analog to wp_trim_excerpt() (the function that applies the excerpt_length and excerpt_more filters to the excerpt), like so: function custom_excerpt( $new_length = 20, $new_more=”…”, $strip = false ) { // Start with the content $text … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)