Custom Sidebar only on single post

In additon to wordpresser answer, you can also call to get_sidebar(‘sidebar-aside-content’); only in the template files where you want the sidebar be displayed. For example, if you include <?php get_sidebar(‘sidebar-aside-content’); ?> in “theme_folder/single.php” file, the sidebar will be displayed only in single posts. For example. In functions.php: //Register your sidebar add_action( ‘widgets_init’, ‘my_widgets_init’ ); function … Read more

Text Widget in Footer for just 1 page template

There are a couple of options: Use a Plugin that adds contextual conditions to Widgets Only output the dynamic_sidebar() in the page template in question. For example, if your custom page template is named template-foobar.php, and the dynamic sidebar name is footer-text-widget: if ( ‘template-foobar.php’ == get_page_template() ) { dynamic_sidebar( ‘footer-text-widget’ ); }

Dashboard Widget drawn before opening HTML tag

Your add_action should call the function that registers the dashboard widget, which then in turn calls the function to render the widget. Right now you have the add_action calling the function to render the widget directly. change: add_action( ‘wp_dashboard_setup’, ‘draw_widget’ ); to: add_action( ‘wp_dashboard_setup’, ‘example_add_dashboard_widgets’ );

is_active-sidebar loop

is_active_sidebar has a single value, whether it is the sideabar id or name. If you have more than one sidebar, you should repeat is_active_sidebar, each one with a specific sidebar id or name. You would do something like this <?php if ( is_active_sidebar( ‘available-course-list-1’ ) && is_active_sidebar( ‘available-course-list-2’ )) : ?>

WordPress widget title coding

The problem is pretty simple: Some widgets do have a title, while others don’t. As long as the title filter is present, it works. Example of what the plugin might have: echo apply_filters( ‘widget_title’, $instance[‘title’] ); If that filter is not present, there won’t be a title.

wp_get_attachment_image() not displaying post images even though wp_get_attachment_url() echo correct urls

When saying “not working” you should include what you expect and what you get; “not working” says very little about the problem you have. Without knowing what the exact problem you have, I guess you don’t see the image. In that case I suggest to change this: wp_get_attachment_image($photo_id, ‘thumbnail’); With: echo wp_get_attachment_image($photo_id, ‘thumbnail’); wp_get_attachment_image() returns … Read more

How is a widget supposed to reference what is added to custom submenu or addmenu fields?

The setting API, which its usage is being demonstrated in that code is meant to be use as a framework to create settings pages which result in update of values in options. Widget settings are is a somewhat more abstract level. They are stored in options, but there is no flexibility how they are stored, … Read more