Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

Så här visar eller döljer du widgets på specifika pages i WordPress

Vill du visa widgetar på specifika pages på din website i WordPress?

När du addar widgets till din website visas de som standard på all pages. Men ibland kanske du bara vill visa valda widgetar på vissa pages. Detta kan hjälpa dig att bättre customize din website och erbjuda en mer personlig upplevelse för användarna.

I den här artikeln visar vi dig hur du visar eller döljer widgetar på specifika pages i WordPress.

How to show or hide widgets from WordPress pages

Varför visa eller dölja widgets på WordPress Pages?

WordPress Widgets allow you to add additional content to your site’s sidebar, footer, and header. De gör viktiga komponenter på sajten, som ett kontaktformulär, knappar på social media, försäljningserbjudanden eller dina mest värdefulla pages, mer synliga för besökare.

Att till exempel displayed a widget search box on the checkout page of your online store does not provide any benefit to your visitors. Men om du visar rabattkuponger för produkter och tjänster i widgetens area kan du öka din försäljning.

På samma sätt kanske du vill hålla din homepage ren och minska distraktionerna. Genom att dölja widgetar på homepage håller du den fri från röran och ökar engagemanget hos användarna på din WordPress website.

Tyvärr erbjuder WordPress inte något alternativ för att visa eller dölja widgetar som standard. Med det sagt kan du fortfarande visa widgetar på specifika pages med hjälp av ett WordPress plugin.

Visa/dölja WordPress widgets på specifika pages

Du kan enkelt dölja eller visa widgets på specifika pages med hjälp av Widget Options. Det är ett komplett plugin för widgethantering som hjälper dig att tilldela och begränsa widgetar för olika pages, posts och devices.

Note: Om du använder ett block theme kommer Widget Options att konvertera dina blockbaserade widget-områden till klassiska widget-områden. Sedan kommer du att kunna använda pluginet för att visa/dölja widgetar på hela din site.

För att komma igång måste du först installera och aktivera pluginet Widget Options. För mer detaljer, vänligen se vår Step-by-Step guide om hur du installerar ett plugin för WordPress.

Efter aktivering kan du heada till Settings ” Widget Options från WordPress admin sidebar. Då hittar du olika alternativ som pluginet erbjuder för att customize dina widgets.

Innan allt annat, se till att alternativet ”Classic Widgets Screen” är aktiverat.

Classic Widgets Screen' option enabled in Widget Options

Detta gör att du kan dölja eller visa widgetar på din website.

Därefter vill du hitta sektionen ”Pages Visibility” och klicka på knappen ”Configure Settings”.

Widget options settings

Härifrån kan you control var dina widgetar kommer att synas och välja var du inte vill visa dem.

Som standard har pluginet redan aktiverat alternativen för fliken post types, taxonomies och diverse tabs. Du kan dock avmarkera boxen för alla alternativ för att customize synligheten för widgetar på olika pages.

Edit page visibility options

När du har gjort ändringarna klickar du helt enkelt på knappen ”Save Settings”.

Nu vill du heada till Appearance ” Widgets från din WordPress admin sidebar. Sedan klickar du helt enkelt på en widget som du vill visa eller dölja. Detta kommer att förstora widgets inställningar, och du kommer att se alternativ för widgetars synlighet.

Under dropdown-menyn ”Hide/Show” kan du välja det relevanta alternativet: ”Hide on checked page” eller ”Show on checked pages”.

Som standard kommer widgeten att vara dold på de kontrollerade sidorna, men you kan ändra det så att widgetar visas på de kontrollerade sidorna istället.

Choose if you want to show or hide widget on the checked pages from the dropdown menu

Låt oss nu se på alternativen för att konfigurera funktionen ”Dölj/visa”. Under dropdown hittar du tre tabs. De är flikarna ’Pages’, ’Post Types’ och ’Taxonomies’.

På tabben ”Pages” finns alternativ för att dölja/visa widgetar på home page/front page, blog section, archives, 404 pages och search page. Gå vidare och välj en page.

Check the pages where you want to hide or show the widget

Efter det kan du gå till tabben ”Post Types” och välja vilka pages du vill dölja/visa WordPress widget.

Gå sedan vidare och växla till tabben ”Taxonomies” och select kategorier för att dölja eller visa dina WordPress widgets. Detta innebär att widgeten kommer att visas eller döljas för blogginläggen i den specifika WordPress-kategorin.

När du är klar, glöm inte att klicka på knappen ”Save” så att du inte förlorar dina framsteg.

Choose categories where you want to hide or show the widget

You can now visit your website to see it in action.

I denna tutorial har vi bara displayed widgeten ”Search” på sidan ”Blogg” och dold den på alla andra pages på vår WordPress website.

Preview for show/hide widgets

Vi hoppas att den här artikeln hjälpte dig att lära dig hur du visar eller döljer widgetar på specifika pages i WordPress. Sedan kanske du också vill se vår lista över de mest användbara WordPress-widgetarna eller läsa vår artikel om hur du skapar en gratis email address för företag.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Avslöjande: Vårt innehåll stöds av våra läsare. Det innebär att om du klickar på några av våra länkar, kan vi tjäna en provision. Se hur WPBeginner finansieras, varför det är viktigt, och hur du kan stödja oss. Här är vår editoriala process.

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

Den ultimata WordPress-verktygslådan

Få GRATIS tillgång till vår verktygslåda - en samling WordPress-relaterade produkter och resurser som varje professionell användare bör ha!

Reader Interactions

65 kommentarerLämna ett svar

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Css Lover says

    You can do all of these things with simple css. (with the spell of display: none !important;) I think you should update this article by adding that option. It’s really simple, no plugins needed. Currently, I just haven’t managed to hide the plugin from the home page. I just need the body id specific to the homepage and I couldn’t find it.

    • WPBeginner Support says

      We will look into the possibility for the future but for the moment we recommend this method as it is simpler than needing to use inspect element :)

      Administratör

  3. Ian Hanson says

    After hours of perusing all my WP Theme options (why it takes me this long to solve problems I’ll never know) I Googled how to show widgets on certain pages and not others…and found your post.

    It’s SO easy now. How I lived without it before I’ll never know. Actually, I don’t think I was living. Thanks!

  4. Jim Gersetich says

    The plugin referenced does not work. I installed Widget Context and activated it. However, the Appearance | Widgets page still only shows the defaults (Blog Sidebar, Footer 1, and Footer 2.) The dialog box you show does not appear, even after closing the browser and reentering.

    • WPBeginner Support says

      The section should be on individual widgets. If they are not appearing you may need to reach out to the plugin’s support to see possible issues.

      Administratör

  5. Vikram Bheel says

    Sir, I bought the Business 5 theme from the instamajo on October 3, 2018. I have 2 problems in customizing this theme.

    1. Apperiance >> Customize >> Widget

    Sidebar 1 is not visible here in place of widget and a message is visible

    Your theme has 1 other widget area, but this particular page does not display it.

    You can navigate to other pages on your site while using the Customizer to view and edit the widgets on those pages.

    How to solve this problem

    2. The option of logging in footer area of ​​this theme is also coming, how to remove it

    Please request to the Wpbeginner team to resolve these issues.

    • WPBeginner Support says

      Hi Vikram,

      Your theme does not display widgets on the page you are viewing in the customizer. An easier way to add widgets is by going to Appearance > Widgets page instead.

      Administratör

  6. Abby says

    Hello, I don’t know to get my subscribe widget to show on every page. Right now it shows on every page on my computer but only shows on my ”About Me” Page for others. I have selected for it to appear everywhere. Can you help?

  7. Katie says

    So I am totally new to this whole thing. I managed to get the TopConsult theme installed and now Widget Context but unless I am being a dumb blonde it’t not working. When I click on a widget the only option I have is to add or cancel. As well as there are ”default widgets” built into the theme one of which is a smart slider that I only want to appear on the home page! And it doesn’t look like I can edit those at all? Can anybody help me?!

  8. Julie Spears says

    I am trying to use the visibility option on my Text widget to hide the sidebar from a specific page. But it isn’t working. The widget still shows up on that page. Any ideas?

  9. john says

    I am sorry but widget context does not have the ability to display on every page? If I click the setting that says show widget everywhere it does not display my slider widget on every page. If I click on show widget on selected and enter a custom URL (the URL to one of the pages on my site) it still does not show the slider widget on that page. I am not sure why or how to fix this but help would be appreciated.

  10. David Norwood says

    Thank you for your reply. I need a plugin like Display Widget, as I have it set up to show menus on the sidebar in specific categories . Maybe I am doing it incorrectly, but it seems to be more global?

  11. David Norwood says

    Thank you for the plug-in suggestion. I need a replacement for Display Widget

    however, widget context Untested with your version of WordPress, which is the most recent .

    Do you if it will be updated anytime soon?

  12. Noel says

    Hi All, it seems this plugin has been removed. Anyone know of another plugin that operates in the same way – showing certain widgets on certain pages and hiding sidebar (show full width page) on pages you do not want the widgets to appear on – similar to what Display Widgets did?

  13. Alex says

    Unfortunately, it looks like the latest WordPress update broke editing the widgets. The settings I had set for my widgets before the update remain, but I can’t change them or add settings to future widgets. Does anyone have a fix for this?

  14. Steve says

    This all works great, however, there is one situation where it does NOT work and that is for a specific URL that is part of a third party integration, like aMember.

    The aMember page do not appear as any of the normal taxonomy, so you would need to somehow add the specific URL to the widget. So far I do not see that functionality.

    Wondering if there is another way to hide widgets you want to shown on the rest of the site, but not on these third party integration pages. Any ideas?

    • Steve says

      Took me only a few minutes to figure this one out, here’s the solution:
      For any pages that reside outside of the WordPress taxonomy, you can use the logic setting. Click the gear symbol, then open the ”logic” tab.
      In my case, simply entering the conditional: is_page( $page = ’/member/*.php’ )
      hides the widgets on all pages associated with my WP integrated third party membership scripts.

  15. Miriam says

    The widget is only showing up on categories, not on pages. I have tried all different combinations and none but categories are working. Please help.

  16. Lori says

    I’m using the Divi theme and the widget isn’t showing on the pages I checked. I have updated to the latest version of the theme and WordPress. Help!

  17. Shaun Taylor says

    Hello,

    This is great and just what I’m looking for, however Is there a way, instead of showing or hiding on different pages, to show and hide in different sections?

    For example if my site structure is:

    Home
    About
    –Subpage
    –Subpage
    –Subpage
    Work
    Services
    –Subpage
    –Subpage
    –Subpage
    Contact

    So rather than me having to choose all of the sub pages in the service section, can I just choose everything under example.com/services/ will show or hide a certain widget?

    Any help would be appreciated! :)

  18. Gaurav Kumar says

    Hi,

    I have removed text widget from blog, still it is loading when I am opening the site.

    Please tell me what should I do.

  19. Victor says

    Hey, does this work with WP 4.5.4 or later? Because I have installed it and shows no difference. Im trying to hide a widget from a page.

    Thanks

  20. Mahendra says

    It will work 100% on some themes.
    But in other themes when you will hide widget, a message will display instead of widget.

    I have a trick for second type of themes.

    Add only text widget, inside the text widget, text will be nothing.

    I have used this trick in my sites. for example I have used in my own site.

  21. Mujahid Rasul says

    I installed and used Widgets Display plugin. why hidden widgets are still occupying space in the site pages. I mean the there should be left only one column showing the text on the whole screen. Now the widgets are not showing but space is empty. please provide solution of this problem

  22. Bob Clinton says

    Installed on WP 4.3 and WP 3.5.1 Just get a blank text area field under the words ”Widget logic: ”

    What am I missing???

  23. AyhanSipahi says

    i used to use widget logic before this.

    is_page(); is_single(23,454,53,1,); used to use code based taxonomies

Lämna ett svar

Tack för att du väljer att lämna en kommentar. Tänk på att alla kommentarer modereras enligt våra policy för kommentarer, och din e-postadress kommer INTE att publiceras. Vänligen använd INTE nyckelord i namnfältet. Låt oss ha en personlig och meningsfull konversation.