How do I add a class to all sidebars to let a Google Custom Search Engine know not to index the content?

If you want to add a class before each widget you should use the dynamic_sidebar_params filter. Another post explains this well. Here’s the gist of it. function uft_add_nocontent_class($params) { $params[0][‘before_widget’] = ‘<aside id=”%1$s” class=”widget %2$s nocontent”>’; return $params; } add_filter(‘dynamic_sidebar_params’, ‘uft_add_nocontent_class’); Otherwise, go and edit your child theme files. If you don’t have a lot … Read more

posts_results filter function memory errors

Sorry folks – for those curious, I had already solved this later on in my functions.php file and forgot to turn this filter off (silly). Here’s the better solution if anyone cares to comment or improve. Basically, I’m filtering out content based on user role (I have a custom user role as well) so that … Read more

Change shortcode output (filter?)

I was able to solve this by using str_replace. function mp_filter_download( $result ) { $search=”<div style=”clear:both;”></div>”; $replacewith=” “; return str_replace( $search, $replacewith, $result ); } add_filter( ‘downloads_shortcode’, ‘mp_filter_download’, 10, 2 );

String Replace Caching & Chance of Collisions

You would probably get at least equally good performance by simply adding the classes with a filter, and it is certainly neater and closer to the way the WordPress is meant to be modified: function add_classes_wpse_190966($classes) { if (in_array(‘current-menu-parent’,$classes)) { $classes[] = ‘active’; } return $classes; } add_filter(‘nav_menu_css_class’,’add_classes_wpse_190966′); Or, with an array of values: function … Read more

Publish button inside custom field group

Try this: <div class=”my-metabox”> <!– This is your metabox HTML –> <– Add this button somewhere: –> <button id=”my-submit” class=”button button-primary button-large”>Submit</button> </div> Add this JavaScript snippet however you want only to this screen (either by checking the post type and enqueue this in the admin footer or output it directly along with your metabox … Read more

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