is_home() and is_front_page() not working in sidebar
I was having the same issue but found an anwser that worked for me. When you use wp_reset_query(); before you use is_home(); or is_front_page(); it will work just fine.
I was having the same issue but found an anwser that worked for me. When you use wp_reset_query(); before you use is_home(); or is_front_page(); it will work just fine.
ID Base should be passed to WP_Widget class constructor as shown in the following code, You have passes wrong id “example-widget” which does not match with “id_base”, also don’t add spaces in id base. Replace MY_Widget() function with following modified function and it will work. function MY_Widget() { $widget_ops = array( ‘classname’ => ‘example’, ‘description’ … Read more
<!– Obsolete You have to create the file named single.php for your single post template. If you use custom post types, name the file like single-my_custom_post_type.php, where my_custom_post_type part is your registered custom post type. Otherwise index.php is used by default. –> Edited: You have to change the file name from page_blog.php to page-blog.php. Notice … Read more
The $post object is not available outside the Loop, unless you globalize it before referencing it: global $post; $variable = $post->post_title;
There can be various way to do it. If the banners would be static then the easiest way i see is to First add the banner to be used in the media using the media uploader and then using the text widget add it to the sidebar using the img tag
How to Remove Sidebar when get_sidebar() is not get called in page?
How can I get the sidebar id on the current page?
I think that using standard WP featurs there’s no shortcut. But you can workaround using a custom widget. As example create a very simple widget, something like: class MyPageWidget extends WP_Widget { function __construct() { parent::__construct( ‘MyPageWidget’, ‘My Page Widget’ ); } function widget( $args ) { $page = get_page_by_path(‘sidebar-page’); if ( ! empty($page) ) … Read more
When you use is_active_sidebar and dynamic_sidebar the argument needs to match the id of a registered sidebar in your theme. In your case that is going to be home_right_1 not sidebar-1 as in the code you copied. Technically, the sidebar name should also work in both and the sidebar index number should work with is_active_sidebar … Read more
I will put a basic code to create new widget. In WordPress its call register_sidebar; In your code, you have not put ID. Id=>your-widget-id Put this code into your functions.php function my_widget(){ register_sidebar( array( ‘name’ => __( ‘Front Sidebar’, ‘yourtheme’ ), ‘id’ => ‘sidebar-1’, ‘description’ => __( ‘This is description’, ‘yourtheme’ ), ‘before_widget’ => ‘<aside>’, … Read more