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

Hur man visar olika sidebar för varje post och page i WordPress

Vill du visa olika sidebars för vissa posts och pages på din site i WordPress?

Ofta vill du visa samma sidebar på hela din website eller blogg. Ibland kan du dock behöva visa olika innehåll i sidebar på några av dina posts och pages.

I den här artikeln visar vi hur du skapar och visar olika sidebars för varje post och page i WordPress.

How to Display Different Sidebar for Each Post and Page in WordPress

När skulle du behöva olika sidebars i WordPress?

Många WordPress teman har en standard sidebar location där du kan add to användbara widgetar och content. Till exempel lägger många webbplatser till ett search-fält i sidebaren eller visar en lista över senaste inlägg.

Om ditt WordPress-tema har en sidebar kommer den som standard att se likadan ut på alla dina posts, pages, categories och archive pages.

Men du kanske vill visa olika widgets för sidebar på vissa posts och pages i WordPress.

Du kan till exempel visa annat content i sidebaren för dina mest populära pages eller visa annonser som är mer relevanta för en viss page.

Du kan till och med använda olika Contact Form beroende på sidans content.

Med det sagt, låt oss se hur du skapar och visar en annan sidebar för varje post och page i WordPress. Använd bara snabblänkarna under för att hoppa direkt till den metod du vill använda:

Metod 1: Visa olika sidebars för varje post och page i WordPress (enkelt)

Om your theme har support för sidebar widgets, kan du enkelt skapa flera sidebar med Lightweight Sidebar Manager. Detta custom sidebar plugin låter dig bygga så många sidebars som du vill och sedan tilldela dem till olika posts och pages.

You can also add them to custom post types or assign a sidebar to all the different pages or posts that have a specific category.

Det första du behöver göra är att installera och aktivera pluginet Lightweight Sidebar Manager. För mer detaljer, se vår Step-by-Step guide om hur du installerar ett WordPress plugin.

När du är aktiverad måste du gå till Appearance ” Sidebars. För att skapa den första sidebaren klickar du på knappen ”Add New”.

Adding custom sidebars to your WordPress website

Du kan nu skriva in en Rubrik för new WordPress sidebar. Detta är bara för din referens, så du kan använda vad du vill.

När du har gjort det öppnar du dropdown-menyn ”Sidebar To Replace” och väljer den location där du vill visa sidebaren. De alternativ du ser kan variera beroende på ditt WordPress tema.

Replacing the built-in sidebar provided by your WordPress theme

Nu kan du kontrollera var sidebaren ska appear genom att skapa regler för inkludering eller exkludering.

För att skapa en inkluderingsregel öppnar du bara dropdown ’Display On’ och väljer de pages, posts, custom post types eller categories där du vill använda sidebaren.

Du kan till exempel add to sidebar till en specifik page, såsom your 404 error page, author archive eller blogg page.

Adding a custom sidebar to the WordPress 404 page

Ett annat alternativ är att använda sidebaren för en viss page, post eller kategori genom att välja ”Specific Pages/Posts/Taxonomies”.

Detta addar till en box där you kan skriva in page, post type eller category.

Creating a custom sidebar for WordPress categories

För att skapa fler inkluderingsregler klickar du helt enkelt på knappen ”Add Display” Rule.

This adds a section where you can create the new inclusion rule.

Adding display rules for custom sidebars in WordPress

Om du föredrar det kan du skapa uteslutningsregler i stället. You kanske till exempel vill visa sidebaren på alla pages utom homepage.

Du kan också kombinera inkluderings- och uteslutningsregler för att kontrollera exakt var sidebaren visas på din WordPress website.

För att skapa en uteslutningsregel för sidebarens location klickar du bara på knappen ”Add Exclusion Rule”.

Displaying different sidebars for pages and posts in WordPress

I den nya sectionen ”Do Not Display On” öppnar du dropdown-menyn och väljer den page eller post som inte ska använda sidebaren.

Du kan också utesluta sidebaren från WordPress pages som har en viss kategori genom att följa samma process som beskrivs ovan.

Displaying different sidebar for each page and post in WordPress

När du har bestämt var sidebaren ska visas på din WordPress blogg kanske du vill visa olika content för olika användare.

Om du till exempel har en membership site kan du använda en annan sidebar för besökare jämfört med inloggade medlemmar.

För att göra detta, öppna dropdown-menyn ”Användare” och välj en roll från dropdown-menyn. Nu kommer endast användare med denna specifika roll att se sidebaren.

Displaying different sidebar widgets on each WordPress page or post

Slutligen kanske du vill skriva in en valfri description. Detta kommer bara att visas i WordPress dashboard, så det är ett bra sätt att dela information med andra administratörer eller användare på en WordPress blogg med flera författare.

Om du ska skapa många sidebars kan du också använda det här fältet för att lämna obs/observera dig själv och användbara påminnelser.

Adding a helpful description to a custom sidebar in WordPress

När du är nöjd med den information du har enter klickar du bara på ”Publicera”.

När det är gjort, gå till Appearance ” Widgets. Du kommer nu att se alla de area för widgets som ditt theme stöder som standard, plus den new sidebar som du skapade i föregående steg.

Adding content to a sidebar or similar widget-ready area

Du kan nu gå vidare och add widgets till sidebar, precis som alla andra widgetar section.

För Step-by-Step instruktioner, vänligen se vår guide om hur du lägger till och använder WordPress widgets.

Adding content to a custom WordPress sidebar

När du är nöjd med hur sidebaren är inställd klickar du på ”Update”.

Nu, om du besöker din WordPress blogg, kommer du att se den nya sidebaren live.

An example of a custom WordPress sidebar, created using a plugin

För att skapa fler theme sidebars, upprepa helt enkelt dessa steg.

Metod 2: Skapa en annan sidebar med ett Page Builder tillägg (fungerar med alla WordPress Theme)

Om ditt theme inte har en sidebar-funktion kan du fortfarande skapa olika sidebars med hjälp av ett drag-and-drop page builder plugin.

SeedProd är det bästa och mest nybörjarvänliga landning page builder plugin för WordPress. Med detta plugin kan du skapa alla typer av customize pages utan att skriva någon kod.

Det har också dussintals professionella kit och templates för webbplatser som du enkelt kan edit och finjustera med hjälp av drag and drop-byggaren.

När du utformar en custom page kan du välja en layout som har en sidebar.

Choose a Layout with a Sidebar

Sedan letar du helt enkelt upp de block du vill visa i sidebaren och addar dem med drag and drop.

SeedProd har alla block och funktioner som du kan förvänta dig av en kraftfull page builder, till exempel formulär för att tacka ja, sociala profiler, nedräkningstimer, kontaktformulär, knappar, olika content-block och mycket mer. Detta gör det enkelt att skapa kraftfulla och unika sidebar för din WordPress blogg.

Drag the Blocks You Wish to Use Right onto the Sidebar

Om du vill veta hur du använder pluginet SeedProd page builder på din webbplats kan du läsa vår guide om hur du skapar customiserade sidofält, headers eller footers för varje WordPress-kategori och hur du skapar en custom page i WordPress.

Learn More sätt att customize din sidebar i WordPress

Vill du förbättra din sidebar i WordPress ytterligare och göra den mer användbar för dina användare? Kontrollera dessa WordPress Tutorials:

Vi hoppas att den här artikeln hjälpte dig att lära dig hur du addar olika sidebars till varje post eller page i WordPress. Du kanske också vill lära dig hur du skapar ett anpassat Instagram feed i WordPress eller se våra expertval för de bästa block-teman för full site editing.

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

56 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. Jiří Vaněk says

    I have a technical section on my blog, which is the majority, and I write technical articles on various topics. The minority part is private, where I write my own opinions on anything (politics, personal life, sports). In elementor, I created a different header and a different footer for both sections so that it was graphically separated. I just needed to finish another menu. I will try your instructions so that both the technical and personal sections have a completely different structure. Thank you very much for the instructions.

  3. Ralph says

    Wow! I never knew i could have different sidebars!
    This is great feature for different categories for my use. Thank you for this guide i will definitely put it to good use!

  4. Finn G says

    can you use this to add sidebar images to both sides of the page and have different images on different pages?

    thanks

    • WPBeginner Support says

      You can use this to have a different image on different pages but for the sidebars of your site normally, it would depend on the specific theme you are using for if they have a second sidebar for the other site or if one would need to be added with a page builder or custom code.

      Administratör

  5. Muhammadd Farhan says

    Wow, you just saved my day! looking for this solution and I got exactly what I need. Thank you for the post.

  6. Jim Joshua Oba says

    Hello! My Sidebar has disappeared. It was displaying before it got missing. However, i din’t change the theme.

    The message reads ”Your theme has 1 widgets area but this particular page doesn’t display it”.

    • WPBeginner Support says

      You would need to reach out to your theme’s support for displaying the widgets properly on that page.

      Administratör

  7. Ken Mbesa says

    This is exaaaaactly what I needed for my portfolio website.

    Thanks WP Beginner. You guys are the best, always!

    I have been a huge user of your resources for over three years now, and your website is one of my most opened bookmarks in all my browsers (in fact, it’s usually just open even when am not using it looking for WP info ;-)).

  8. M.IFTIKHAR says

    Hi ! I have a problem in my wordpress website that the sidebar on shop page is not showing up but when i custimize the shop page it still show but not showing on default shop page .Please tell me why this is happening ?

    • WPBeginner Support says

      You would want to start by reaching out to your theme’s support to see if this is a known issue with your theme and they should be able to assist.

      Administratör

  9. Peter P. says

    We tried this plugin but it wasn’t really usable for many sidebars. We had a hundred posts where the sidebar should contain more information about each product. Already after 10 sidebars the system became slower and slower, until it finally became unbearable with 20 or 30 sidebars.
    We then used a different, differently designed solution that didn’t require a sidebar.

  10. Poorya says

    What happens to the posts/pages which have multiple categories selected?! or with several tags?
    For example, I want a custom category for the news section and another for tourism, but what happens when a post appears on both of these categories?

    • WPBeginner Support says

      You would need to check with the plugin for what would happen when a conflict like that happens. If you have multiple posts in different categories then you may want to take a look at how you have your categories themselves set up

      Administratör

  11. Marco Diversi says

    hello, I am trying to find a solution to add embed code to the sidebar of a post.

    what i would like to have is a plugin that allow you to add a html or txt widget to the side of one single post, I have spent some time trying to find this but can not find! I have a website where every post is a different location and it needs a different map each post.

  12. BRENDAN says

    This one seems dead Syed, plugin not updated in 2 years so likely missing a lot of integration since WordPress has undergone some major core upgrades over the last 12 months. Is there a more recent solution for sidebars?

    • WPBeginner Support says

      Thank you for letting us know, we’ll certainly take a look at this article and possible alternatives

      Administratör

  13. Rushikesh says

    Is it possible without any plugin, on Genesis framework? because I have purchased NEWS PRO Genesis Theme.

  14. Katy says

    Thank you so much! I have been driving myself mad trying to fix the sidebar then I found your video! Thankyoooou!!

  15. aba charles says

    Really nice and detailed tutorial you have here. But i don’t know why after following it my sidebars are still not appearing

  16. Soumik Sadman Anwar says

    Is there any way to show no sidebar on a certain page at all?

    Remember, the other pages will have to show the sidebar.

  17. becka says

    Is there a way to change the sidebar on certain pages and have it removed entirely on others? Before I download and activate I would like to know if removing the sidebar completely and making the page width 100% as easy as making different sidebars for different pages

  18. Linda says

    Hello – I have a sidebar on my weekly blog page but when I click on read more, it takes me to the full page width and doesn’t show the sidebar. I have looked everywhere to try and do this. Can anyone help please?

  19. Dr Jill SM says

    I tried to use the easy side bar and it does not work! I want to put a side bar only on specific pages and this put it on ALL of them.

    I had learned how to use the original appearance > widgets and had right side bar on certain pages. I just added a new page to my web site and got the side bar that I did NOT want. I tried to add a left side bar to ONLY my new page and could not do it. So I looked at this video and got the plug-in easy side bars and it does not add a left side bar to ONLY the new page nor does it help me remove the right side bar [done through appearance > widgets] from the new page. Not real helpful.

  20. K.Mr says

    Hi, I need small help that you could do. I’m planning to buy managed wordpress on godaddy. I write posts in two languages. 1 is supported by adsense and one is not. I would like to place ads on posts using this on supported only language posts. Can I do this ? Can i use this to place ads? Please could you tell me?

  21. Kati K. says

    Hi! Can I add more sidebars with this plugin? Do I have to replace my existing sidebars with these new sidebars? For example, I have now 3 optional sidebars and I would like to have more than that. Is that possible somehow? Thanks!

  22. Jennifer L says

    I installed this plugin and now my site doesn’t work at all!! How do I fix this, it is really important! Please advise.

    Jennifer

    • WPBeginner Support says

      Hi Jennifer,

      You can manually delete the plugin using FTP. Connect to your website using FTP client and go to /wp-content/plugins/ folder inside it you will find easy-custom-sidebars folder. Delete it and then login to your WordPress site. You can reinstall the plugin again if you want to give it another try.

      Administratör

      • Ale Goedrich says

        Hello – I have the same problem. The only choices I get is to replace the Footer Widgets 1 – 4. There are no other choices. Any ideas? I’d like to add a sidebar to my products thats different from my blog sidebar. I am using Divi.

        Thank you, Alex

  23. Claire C says

    Useful! I definitely want the ability to change my sidebar at times – my theme provides up to 8 choices, including full width (ie. none) for my pages but only ’on’ or ’off’ for all posts. So my question is, specifically for each individual post, could I chose 1. to add a sidebar of my choosing or 2. to have no sidebar at all (ie. full width)? Thanks

  24. Dave DeWitt says

    Wow! This feature is something I’ve been wanting to do for a while. As usual, wpbeginner, makes it easy and fun! Thank you!!

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.