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 max-width:97.5% on content images?

Since the TwentyEleven theme also includes some default padding and a border for (fluid) images (see CSS below), a width of 100% would push the image outside of its container’s width. This is because of how the box model works: border and padding are added to the width/height. img[class*=”align”], img[class*=”wp-image-“], #content .gallery .gallery-icon img { … 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 )), );

What is the best practice for customizing a plugin’s JavaScript/jQuery?

If a Plugin is coded properly, it will: Use core-bundled jQuery, and any other core-bundled script, rather than bundling/using custom versions of such scripts enqueue its scripts, via wp_enqueue_script(), hooked into an appropriate hook, via an explicit function So, for such a Plugin: You won’t need to worry about customizing/overriding core-bundled scripts, since the Theme … Read more

Add class to before_widget for all widgets with a dropdown and a counter

The CSS classes are applied in the function dynamic_sidebar(). There is no specific filter for that: // Substitute HTML id and class attributes into before_widget $classname_ = ”; foreach ( (array) $wp_registered_widgets[$id][‘classname’] as $cn ) { if ( is_string($cn) ) $classname_ .= ‘_’ . $cn; elseif ( is_object($cn) ) $classname_ .= ‘_’ . get_class($cn); } … Read more

How can I see what template parts are being called for rendering the viewable page?

You can view the template part by using get_template_part($slug) It’s one of those hidden gems inside of WordPress that don’t get the attention they deserve. The get_template_part function is essentially a PHP include or require, on steroids: It already knows where your theme is located and it will look for the requested file in that … Read more

How to access certain WP functions inside custom class, in theme folder

You’re actually calling the add_meta_box() function before it’s defined, when you run this directly: \ci\wp\Metaboxes::addMetabox( ‘front_page_slide_settings’, ‘Slide settings’, ‘page’, ‘normal’, ‘high’ ); You don’t mention where you run it, but it’s too early or you run it in the front-end, where add_meta_box() is not defined. The add_meta_box() function is defined within this file: /** WordPress … Read more