the_widget() and widget’s ID

Let’s assume I have a widget that displays only its name: <p> <?php echo $args[‘widget_id’] ?> </p> So when I drag & drop my widget to any sidebar it shows: <p> myWidget-number </p> The problem is I want to call this widget with a shortcode: (…) ob_start(); the_widget(MyWidget); return ob_get_clean(); } add_shortcode(‘myWidget_short’, ‘myWidget_shortcode’); And when … Read more

Make “sidebar template” the default template for new pages

On Twenty Eleven or on its child themes the default template for new pages is a template with no sidebar. I don’t know why this is like this; it seems to me that the designers of WordPress are still not thinking about CMS functionality in some places. For example the most obvious place to put … Read more

How to check if searchform.php is being included as widget?

I’d like to put something like this in searchform.php: <?php if($widget){ ?> //load serach form for sidebar… <?php }else{ ?> //load different search form for page content (404 page) <?php } ?> How can I prepare $widget variable? Or maybe I should use another method? Like filter? Or get template part? 2 Answers 2 Check … Read more

duplicate sidebar

I have a problem with a sidebar. I have 4 sidebars: “Essential”, “Essential+”, “Premier” and “Premier+”. register_sidebar( array( ‘name’ => __(‘Essential Plan’), ‘before_widget’ => ‘<ul>’, ‘after_widget’ => ‘</ul>’, ‘before_title’ => ”, ‘after_title’ => ” ) ); register_sidebar( array( ‘name’ => __(‘Premier Plan’), ‘before_widget’ => ‘<ul>’, ‘after_widget’ => ‘</ul>’, ‘before_title’ => ”, ‘after_title’ => ” ) … Read more

I need some direction on how to have a sidebar based on meta rather than page

I’m working on a plugin that allows the user to create “page/post types”, customize the type style, then tag a page/post with that type. All of this works. My problem is this plugin also needs to allow them to attach widgets to said type. I have no way of knowing how many “types” there are … Read more

Way to hook into a sidebar call to replace it with a custom sidebar

I want to replace the sidebar-2 in the twentyforteen theme with a custom sidebar based on a conditional statement for CPT. So if the page is showing a certain custom post type then show my custom sidebar, else just show the default sidebar. I want to do this without changing the theme or using a … Read more

Disable Sidebar in the Product Page in Storefront Theme [closed]

Closed. This question is off-topic. It is not currently accepting answers. Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third party plugins and themes are off topic, they are better asked about at their developers’ support routes. Closed 5 … Read more