Is there a filter to programmatically change the HTML tab switching output of the page editor?
You can do it with help of jQuery like this: jQuery(document).ready(function() { jQuery(‘.switch-tmce’).trigger(‘click’); });
You can do it with help of jQuery like this: jQuery(document).ready(function() { jQuery(‘.switch-tmce’).trigger(‘click’); });
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
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
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.
Copy header.php to your child theme so you’re not editing the parent theme’s file. And on line 49, you will see this line of code: if ( ! empty( $header_image ) ) : ?> This says if header image is not empty show the header image. So you can add to that condition to check … Read more
In functions.php: function myExcerpt($text) { $text = str_replace(‘]]>’, ‘]]>’, $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() );
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
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
The $post object is available outside the loop so you should be able to echo get_the_title( $post->ID ); in the body.
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