add_filter to post-gallery and remove all ‘s?

EDIT: you must call your filter after the shortcode is processed, giving it priority > 10, and you must match on a multiline expression. Try this work with my installation and using the standard gallery shortag: add_filter( ‘the_content’, ‘remove_br_gallery’, 11, 2); function remove_br_gallery($output) { return preg_replace(‘/<br style=(.*)>/mi’,”,$output); }

Why might $input (Settings API) be coming through empty?

The $input variable is not passed to the validate function by default. You need to declare it, e.g. not this: function mytheme_validate_settings() {} But rather, this: function mytheme_validate_settings( $input ) {} (Or maybe I’m the only one who’s made that bone-headed mistake before?) 🙂 EDIT: The other thing to check: does the $optiongroup in register_setting() … Read more

Why is my custom meta box input not saving

Try changing: <input class=”widefat” type=”text” placeholder=”[galleryview id=X]” name=”rs-job-gallery” id=”rs-job-gallery” value=”<?php echo esc_attr( get_post_meta( $object->ID, ‘rs_job_gallery’, true ) ); ?>” size=”30″/> to this: <input class=”widefat” type=”text” placeholder=”[galleryview id=X]” name=”rs_job_gallery” id=”rs-job-gallery” value=”<?php echo esc_attr( get_post_meta( $object->ID, ‘rs_job_gallery’, true ) ); ?>” size=”30″/> Reason: When the “name” attribute is set in the input field, that becomes the $_POST[‘input_name’] … Read more

Show Video in Excerpt

filtering the_excerpt() If you remove_filter( ‘get_the_excerpt’, ‘wp_trim_excerpt’ ) and add your own get_the_excerpt filter you can do this. The default filter (wp_trim_excerpt()) can be found on line 2023 of /wp-includes/formatting.php if you want to just modify that. The extent of what you need to do is just modifying which tags are allowed in strip_tags(). overriding … Read more

How to change post thumbnail title and alt attributes to post title?

Look at this http://codex.wordpress.org/Function_Reference/the_post_thumbnail second argument in this function you can set a few set fields, such as alt, title, source and class: $default_attr = array( ‘src’ => $src, ‘class’ => “attachment-$size”, ‘alt’ => trim(strip_tags( wp_postmeta->_wp_attachment_image_alt )), ‘title’ => trim(strip_tags( $attachment->post_title )), );

How to create a widgetized sidebar for every category dynamically?

Not a good thing if you have a lot of categories, so be careful! First, add the following function in functions.php: add_action( ‘widgets_init’, ‘generate_widget_areas’ ); function generate_widget_areas() { //Do not create for uncategorized category $terms = get_categories(‘exclude=1&hide_empty=0’); foreach ($terms as $term) { register_sidebar( array( ‘name’ => ‘Category ‘.$term->name, ‘id’ => $term->slug.’-widget-area’, ‘description’ => ‘Widget area … Read more