I want to add a class to main div on a template. how can I do that?

You’re probably looking for something like this: <?php function add_classes_to_body_class($classes) { // make sure ‘page-template.php’ matches your template name if ( is_page_template(‘page-template.php’) ) { $classes[] = ‘main’; } return $classes; } add_filter( ‘body_class’, ‘add_classes_to_body_class’ ); ?> make sure you add body_class() into your markup. Traditionally it would be in your body tag like so. <body … Read more

Duplicate and alter sidebar for Twenty Eleven

the layout is controlled by the .singular css class, which in turn is generated in functions.php depending on the template. in your child theme of Twenty Eleven (if you don’t have a child theme, create one first) add this code to functions.php: add_filter(‘body_class’, ‘wpse_28044_adjust_body_class’, 20, 2); function wpse_28044_adjust_body_class($wp_classes, $extra_classes) { if( is_page_template(‘submenu-page.php’) ) : // … Read more

WordPress Multisite: Have the same header and footer of main-blog on all sub-blogs

You could use the switch_to_blog() function Switches the active blog until the user calls the restore_current_blog() function. This function is useful if you need to pull posts, or other information, from other blogs, you can then switch back after using restore_current_blog(). Using this function will not load plugins that only run on the blog you … Read more