Hide widget on page

You can use this snippet. Just make sure you change the widget id : <?php add_filter( ‘widget_display_callback’, ‘widget_display’, 50, 3 ); function widget_display( $instance, $widget, $args ){ if ( is_page() && $widget->id == ‘text-39’ ) { return false; } return $instance; } ?> The easiest way is to use a WordPress plugin though. There are … Read more

How do I get shortcode, widget and template tag CSS to load in the head only as required? [duplicate]

Neither wp_enqueue_style() nor wp_register_style() have a parameter to allow them to be loaded in the head, rather than the footer, as their script counterparts do. The only solution is to have some of your CSS (or all of it – which would be bad) inside a style tag inside head, added with the wp_head action … Read more

Custom widgets do not appear in dashboard > appearance > widgets

The glob function is not supporting GLOB_BRACE on the host. The code in functions.php can be replaced by $widgets = glob(get_template_directory().’/widgets/*.php’); foreach ($widgets as $widget) { $className = str_replace(‘.php’, ”, basename($widget) ); include $widget; } to fix the issue.

Add text to Text Widget using Javascript

Where are you using document.write? Inside the text widget? If so, it should write text inside that widget, just like you want. document.write injects data where it’s encountered. So if you’re using it outside the document body it will produce unexpected results (like overwrite the document, in most cases). **Update, add this in your text … Read more

Include widget within newsletter template?

You may already know this, but you need to specify the widget’s class name as the $widget_name variable in the template tag. For example, Depending on the widget, you may also need to add parameters to the_widget() to get it to display properly — see notes on thewidget() $instance and $args in the codex. http://codex.wordpress.org/Function_Reference/the_widget … Read more

menu in different page in different style

you can use this, <?php if( is_front_page() ):?> <div class=”home-page-menu”> wp_nav_menu( array( ‘container_class’ => ‘menu-header’, ‘theme_location’ => ‘primary’ ) ); </div> <?php elseif; ?> <div class=”inside-page-menu”> wp_nav_menu( array( ‘container_class’ => ‘menu-header’, ‘theme_location’ => ‘primary’ ) ); </div> <?php endif; ?> Here, you should be change your CSS style for home-page-menu and inside-page-menu . for more … Read more