I have been trying and searching to accomplish this. I have the "custom menu" widgets "Members Area", "Admin Area" in side bar, assigned menus to them. Fine, they display. I want to show "Admin Area" widget only when the current user is admin. I believe it has something to do with adding a filter to "sidebars_widgets". Honestly, i do not have a clue to target the "Admin Area" widget. How do I handle this ?
I have created a custom sidebar widgets using below code : register_sidebar(array( 'id' => 'sidebar-widget-1', 'name' => 'Sidebar Widget 1', 'before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => '', )); and it is showing in Appearance -> Widgets and it is also showing content on frontend using dynamic_sidebar('Sidebar Widget 1'). But I want to get content of this register_sidebar by using its id into a variable. How to get sidebar content by using its id?
I'm trying to remove a widget area called 'Primary' from a certain page on a site. This is the function where I manage the sidebars: //ADD CATEGORIES IN SIDEBAR OF SINGLE POST TYPE add_action( 'genesis_sidebar', 'add_mysite_sidebar' ); function add_mysite_sidebar() { if( get_post_type() == 'post' ){ dynamic_sidebar( 'News Categories' ); } else if( get_post_type() == 'events' ){ dynamic_sidebar( 'Event Categories' ); } else if( get_post_type() == 'documentlibrary' ){ dynamic_sidebar( 'Document Categories' ); } else if( get_post_type() == 'bp_members' ){ include(members_sidebar.php); unregister_sidebar( …
I have been struggling with this for hours now, any help appreciated. I am using Underscores theme with one sidebar (sidebar-1, on the left) and Custom Sidebars plugin so that I can have different side content on each page. The problem is when I add a new sidebar (sidebar-2) which I want to appear just above the footer to contain the same content on every page. functions.php: function myunderscores3_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Sidebar', 'myunderscores3' ), 'id' => …
I am trying to make a product listing site using WooCommerce. Now the system is when someone clicks on any category, they go to the subcategory page. I want to add a sidebar with all product categories on the subcategory page. How can I do that? Here is the link : https://cctv.abmsrilanka.com/products/
I'm taking a Udemy class to learn how to make Wordpress plugins and themes. The video I'm on is having me override the default search widget with a custom one via searchform.php. From what I've gathered, this file should automatically be loaded with the rest of the theme as long as I have followed these steps: /theme_dir/functions.php /* Some other code */ include ( get_theme_file_path('/includes/widgets.php') ); add_action("widgets_init", 'ju_widgets'); /theme_dir/includes/widgets.php function ju_widgets() { register_sidebar([ 'name' => __('My First Theme Sidebar', 'udemy'), …
I'm running the base 2016 wordpress theme. I have modified it to allow for a left side sidebar. I am able to see the admin side of the sidebar like so: I have registered the call in the functions.php page like so: register_sidebar( array( 'name' => __( 'sleft', 'twentysixteen' ), 'id' => 'sleft', 'description' => __( 'Add widgets here to appear in your sidebar.', 'twentysixteen' ), 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h2 class="widget-title">', 'after_title' …
Ever since my previous website update (developer no longer with me), I am having an issue with Wordpress widgets on my sidebar moving to below the content, rather than remaining on the sidebar on https://morpheustrading.com/blog/. The issue seems to be that ALL widgets are moving to the bottom of the page if the text content is too wide in any individual widget. For example, a narrow HTML block of code remains on the sidebar, but all widgets move to the …
I have an archive page which displays current category. On the right I have a sidebar that should display recent posts, but without posts that belongs to the current category that I am watching. Here's the image: So I want my Headlines, not to show Basketball category. Of course, this could be dynamicaly, when watching football category, not to show football etc.. Thanks
I have 2 sidebars(primary and secondary). I want the secondary sidebar to display only on the blog page and primary sidebar to display everywhere else except for the blog page. What have I tried: In functions.php : if (is_page('blog-35')) { get_sidebar('secondary'); } else { get_sidebar('primary'); } Unfortunately this doesn't work. Any hints on how to debug this? I don't understand what am I doing wrong in the code above.(blog-35 is the body class of the page I want to display …
Using a child theme of genesis and am unsure of how to remove a contact us widget in sidebar from the contact us page. Is there an easy way to do so? It's part of the theme which has it on the side so when I remove this widget from one page it's removing it from all of the pages. I'm using News Pro Theme (child of Genesis) and am unsure of where to edit this in the template files. …
I'm trying to display a custom widget in the sidebar of my homepage (which is a static front page defined in Settings > Reading). Here is the relevant part of my sidebar.php: if ( is_front_page() || is_home() ) { if ( is_active_sidebar( 'sidebar_lecture' ) ) : ?> <div id="secondary" class="widget-area" role="complementary"> <?php dynamic_sidebar( 'sidebar_lecture' ); ?> </div> <?php endif; The sidebar does not display because the conditional tag does not recognize my homepage as being a homepage. When I print_r($wp_query) …
I know this question has been answered many times before, including here where i came from so it'll probably be real simple. I've registered my sidebars as normal function wmw_sidebars() { // Register default widgetized areas $sidebars = array( 'primary' => array( 'name' => __( 'Primary Widget Area', WMW_ADMIN_TEXTDOMAIN ), 'desc' => __( 'The primary widget area', WMW_ADMIN_TEXTDOMAIN ) ), 'home' => array( 'name' => __( 'Homepage Widget Area', WMW_ADMIN_TEXTDOMAIN ), 'desc' => __( 'The homepage widget area', WMW_ADMIN_TEXTDOMAIN ) …
Need to insert the sub menu of the current page into the current page's sidebar. Is this possible? What I'm interested in developing would be a menu that looks like this: menuItem1 => subitem1, subitem2 menuItem2 => subitem3, subitem4 Navigate to Item1 page where the sidebarA contains the menu links sub1, sub2. Navigate to Item2 page, sidebarA contains menu links sub3, sub4. Any suggestions on how to do this either programmatically or with a widget? Thank you.
I use the following code to add a custom option in the Gutenberg-sidebar. Its visible and saving the Checkbox-value works. But: if I click on the CheckboxControl nothing visible changes on it. If it is not checked and I want to check it, it does not go checked. The "Update"-button goes active and I see the checked Checkbox after it. Why? import { CheckboxControl } from '@wordpress/components'; import { dispatch, select } from '@wordpress/data'; import { PluginDocumentSettingPanel } from '@wordpress/edit-post'; …
I need to display the complete posts list in the dropdown list in the custom block sidebar. I used for that withSelect: ... const currentPostId = select('core/editor').getCurrentPostId(); const query = { orderby : 'date', order : 'asc', status : 'publish', per_page: -1, exclude: currentPostId, } return {articleList: select('core').getEntityRecords('postType', 'post', query)} ... My issue is that I have a lot lot lot lot ... of posts and so it takes a life to get the list in my selectControl. I so …
I'm using WordPress multisite and need to display content across all subsites in the sidebar. This is a network of 50+ sites so updating all 50+ sidebars with this content every few days is not practical. One solution I've found is to simply insert the content I want into sidebar.php in the theme editor, though I don't want my client editing this file, and want them to use TinyMCE editor instead of HTML. Another idea was to embed an iframe …
What is the difference with get_sidebar() and dynamic_sidebar()? I was wondering which one I should use. Maybe one use widgets and the other one doesn't?
I am trying to pass the sidebar that I have in the shop, inside a side drawer that will have the filters. I have created the HTML/CSS and the js responsible for this to work. But I am trying to get the content of all the sidebar from the database and apply it inside my drawer. I am a bit of a junior in PHP and in WordPress development. So any guideline on how to achieve this would be appreciated. …
I am using this below code to remove woocommerce sidebar, from cart and single-product page. function urun_sidebar_kaldir() { if ( is_product() || is_cart() ) { remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 ); } } add_action( 'woocommerce_before_main_content', 'urun_sidebar_kaldir' ); It works in single-product page, but it doesn't work cart page. I can't remove sidebar in cart page. //Update I am not using woocommerce.php in theme main folder. And i have this templates in my theme. wp-content/themes/{current-theme}/woocommerce/cart/cart.php I created custom teplate for cart. And …