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 fixar du error med sidebar under content i WordPress

Vill du lära dig hur du fixar sidebar under content error i WordPress?

Denna issue kan uppstå när WordPress templates använder en tvåkolumns layout för content och en sidebar. På grund av en liten ändring i koden börjar sidebaren att appear under innehållet istället för bredvid det.

I den här artikeln kommer vi att visa dig hur du enkelt fixar sidebar under content error i WordPress.

Fixing the sidebar below content editor issue

Vad orsakar WordPress Sidebar under Content Error?

Den vanligaste orsaken till att sidebaren dyker upp under innehållet är ett HTML- eller CSS error som bryter layouten.

Varje <div> i HTML måste vara ordentligt close. Om den template som ansvarar för att page displayed har en oavslutad <div> tagg, så kommer detta att bryta layouten.

Closing all divs in WordPress theme layout

På samma sätt kan en oönskad close </div> tag också påverka layouten och göra att sidebaren flyttas nedåt.

Förutom HTML påverkar CSS också den övergripande designen av varje element på din WordPress website. Det används för att definiera bredden, inriktningen och flytet av element i din layout.

Enkelt uttryckt, om bredden på ditt content area är större än det available space, så kommer sidebaren att tvingas flytta nedåt.

Sidebar below content area

Först måste du ta reda på vilken specifik kod som orsakar detta error i sidebar i WordPress.

Med detta sagt, låt oss ta en titt på hur man enkelt felsöker och fixar sidebar under content error i WordPress. Du kan använda dessa länkar för att hoppa till en specifik lösning för troubleshoot:

Metod 1: Ångra de senaste ändringarna i ditt WordPress Theme

Vanligtvis orsakas sidebar issue av ändringar i dina WordPress theme-filer.

Om du senast har gjort några ändringar i ditt WordPress-tema eller barntema, kommer det att vara ett snabbt sätt att fixa detta error genom att undersöka dessa ändringar.

Om du inte kan räkna ut vilka ändringar du behöver återställa, fortsätt Läsa, så visar vi dig andra sätt att felsöka.

Metod 2: Clear cachen i WordPress

Website not updating

När du gör ändringar som inte visas direkt beror det ofta på issues med caching.

Det är vanligt att tillägg för caching visar en äldre version av samma page för you. Genom att cleara WordPress-cachen och webbläsarens cache kan du se de ändringar som tillämpats på din website.

Metod 3: Uteslut tillägg till WordPress

Din WordPress sites appearance och stil kontrolleras av det theme som du använder. Ibland kan dock tillägg till WordPress också add to sin egen HTML och CSS till din website.

Om du t.ex. lägger till ett kontaktformulär på en page eller en lightbox popup laddas ytterligare CSS och HTML.

För att säkerställa att issue inte orsakas av ett WordPress plugin, kan du tillfälligt deactivate alla WordPress tillägg på din website.

För att göra detta, headar du bara till Plugins ” Installerade plug ins i din WordPress adminpanel och kontrollerar boxen bredvid ”Plugin” högst upp i listan. Öppna sedan dropdown-menyn, välj ”Deactivate” och klicka på ”Tillämpa”.

Deactivate all WordPress plugins

Om problemet försvinner betyder det att ett plugin orsakade issue. Aktivera alla dina tillägg till WordPress ett efter ett och kontrollera din website efter varje tillägg för att ta reda på vilket som orsakar problemet.

Efter det kan du kontakta supporten för pluginet för att hitta en lösning och rapportera the issue.

För detaljer kan du kontrollera våra tutorials om hur du enkelt inaktiverar WordPress plugins och hur du inaktiverar plugins när du inte kan komma åt WordPress admin area.

Metod 4: Fixa trasiga <div> Taggar som bryter layouten

Som vi nämnde tidigare är en trasig <div> tagg en av de vanligaste orsakerna till att sidebaren flyttas under innehållet.

Om issue orsakas i ett specifikt area på your website kan du kontrollera templates som ansvarar för att displayed koden.

Till exempel, om denna issue endast uppstod på enskilda inlägg, kanske du vill kontrollera single.php templates. För att ta reda på vilken template du ska titta på, se vår kompletta WordPress mall-hierarki fusklapp.

Det enklaste sättet att snabbt hitta ett oavslutat div-element är att använda verktyget W3C Validator.

Using HTML Validator tool

Du kan också använda Inspect-verktyget eller appar för kodredigerare som hjälper dig att debugga kod genom att markera elementens start- och sluttags.

Här är ett exempel på hur du markerar ett elements start- och sluttaggar:

Debugging HTML error using a code editor

När du tittar på koden måste du se till att alla <div> taggar som öppnas också har en close <div> tagg.

På samma sätt vill du också leta efter en föräldralös stängande </div> tagg som inte har en motsvarande öppen <div> tag g.

Om du har hittat de trasiga HTML-taggarna kommer du att lösa problemet med sidebar som visas under innehållet genom att fixa det.

Metod 5: Hitta CSS som flyttar sidebaren under innehållet

CSS kontrollerar de viktigaste aspekterna av designen på din website. Ditt WordPress-tema använder CSS för att definiera bredden på content och area för sidebar i en grid layout.

Detta värde är i procent av den area som är available för view. På mobila enheter kommer ditt theme automatiskt att skjuta ner sidebaren under innehållet.

För att ta reda på vilken CSS som orsakar issue kan du använda Inspect tool. Genom att helt enkelt flytta your content till wrapper field, content section och sidebar areas kommer du att se deras bredd och höjd.

Check CSS width issues

For instance, if your content area is 70% wide and the sidebar area is 33%, then it will automatically move down. När du beräknar dessa värden kanske du också vill ta hänsyn till det utrymme som används av padding och marginalvärden i varje section.

Vad ska jag göra om error med sidebar under content fortfarande finns

Om du har provat alla felsökningsmetoder och fortfarande inte kan fixa problemet med sidebar, kanske du vill kontrollera vår nybörjarguide för felsökning av WordPress-fel för att hitta fler lösningar.

Ett alternativ är att aktivera debug-läget. Även om det inte är en direkt fix kan det avslöja mer specifika felmeddelanden relaterade till sidebar-problemet.

Det kan till exempel avslöja ett PHP error message som nämner ett specifikt plugin som orsakar en CSS style issue som påverkar sidebarens layout. Denna information kan hjälpa dig att identifiera det problematiska tillägget och eventuellt hitta en lösning eller ersättning.

Om du ej känner dig bekväm med att felsöka vidare kan du kontakta vårt team på WPBeginner Pro Services. Våra WordPress-specialister kan hjälpa dig att diagnostisera orsaken till problemet med sidebar och ge dig en lösning.

WPBeginner Pro Services

Vi hoppas att den här artikeln hjälpte dig att lära dig hur du fixar error med sidebar under content i WordPress. Du kanske också vill läsa vår ultimata handbok om vanliga WordPress error och vår artikel om hur du visar olika sidebars för varje WordPress post och page.

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

41 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. Gina Detwiler says

    I’m not certain how to find that div element. Can you elaborate a bit? I’ve had this problem from the beginning with my site and don’t know how to fix it.

  3. Shai says

    Thank you so much!
    You just saved me a lot of time trying to resolve it.
    As you said I had an extra div element closed

  4. Dale Jennings says

    I am trying to put my current posts on the left and recent posts in a right sidebar and the sidebar is down at the bottom of the page, also it is too wide, and I do not understand what you were talking about since I am new to this. what is an easy fix?Or is there one?

  5. Ayla says

    I’m having the issue where my sidebar is showing up on the bottom of every page. I am not very savy with this so have not done anything fancy other than transfer my domain from google recently. I have been building the site in wordpress and did not have any issues until I changed the theme. I tried the instructions above but couldn’t find any of those things.

    • WPBeginner Support says

      Hi Ayla,

      Try switching temporarily to your previous theme or a default theme. If this resolves the issue, then the issue is with your theme. Try reaching out to theme developer to see if they can help you fix that.

      Administratör

  6. Donald Efiom says

    I have the same problem right now and I can’t seem to find where to edit the HTML of the shop page im diaplayin products using the wcommerce plugin. When I inspect element on my browse, I can debug the error and correct it but in my actual root directory, I can’t find the page that holds the HTML of the shop page of woocommerce that I can edit. Pls help!

  7. Maria Appleby says

    For the life of me I cannot fix my sidebar issue. I searched for open blocks. I removed one blog post that was wonky with HTML due to me copying content. I tried a different theme. I took off my widgets (and then tried to add one to see what would happen – the ”follow blog” button” – still on the bottom). I tried the validator but don’t really understand what it is telling me. When I entered different blog post urls, I got the same error messages. I’m sorry I sound so stupid….I’ve had the blog a long time, but only recently started adding a lot of content, and I don’t really know what I’m doing yet. THe sidebar ended up from the right side, to the bottom of the blog, very recently (past couple of days). Can you help me?

  8. Sparsh Goyal says

    I have same problem but unable to solve it. Only my home page have this problem. Post-type page and Page-type page are working well. My home page sidebar is going on top rather than going just next to my content. Can you please check what is going wrong in my website. My site is coasilat.com

  9. Mustafa says

    Thank you. It is sorted the problem. it was and extra div element. when i get rid of it problem is fixed.

  10. Asha Shendre says

    I had troubled whole day for this.
    problem solution got only here.

    Thank you..
    Thank you very much sir…

  11. Sly says

    Hi, I’m a beginner. I don’t know ANYTHING about CSS or HTML code, I don’t edit my theme, I have no child theme. I only add plugins for whatever I need to do. I see to be having the issue with ALL MY BLOG POST PAGES. The sidebar is below the blog posts. I have no idea what is a div and how to fix it. Dear pros, what would be the best way for my to solve this sidebar issue?

    • Tamara says

      I’m a beginner and not a coder either, but was able to solve this problem by using the W3 Validator link on this page. At the top of the validator, under Options, I checked all available then entered the web address of my blog and ran the validator. Below a numbered list of errors was a very detailed (and intimidating, but hang in there) display of the errors as they’re located within the text of my blog. I focused on the mentioned in this article. Scrolling through the detailed report, I found one error that was highlighted in red. Since my text was displayed, I could see that it was in one of my blog posts just after an internet link I’d inserted. I went to that blog post on the WordPress dashboard, clicked ”edit” and deleted the link. (Holding down ”delete” to be sure I got any invisible anything that might be there and backspacing a couple of letters for the same reason. I then saved the blog post. My webpage was fixed! I then re-edited the blog post to add back in the link and all remained fine. Problem solved.

  12. Lisa W Boyle says

    Thank you I was able to immediately find and fix the problem based on your instructions. I found I placed and extra in my single.php file. Your a live saver, thank you so much!

  13. Roney Oenophile says

    I dont know what wrong I did, pls help me. I was editing text and I accidentally pressed a combination of keys which changed the way it looked. few buttons like full screen is missing now. And the publishing button is moved to left side. And the pic that I uploaded with the post moved upside my content and it is very big now. I don’t know how it happened, I don’t know what is the problem. I am not computer friendly. I usually write posts. Pls help me. The address of my page is wordpress.com

  14. Danielle says

    First time taking over updating of our site…tried to update the static home page and somehow my sidebar went to the bottom. I can’t see any or tags….help! I don’t want to tell the person i took over from i already screwed up if i can figure out what i did!

  15. Susan says

    Perfect! Thanks! I knew the minute you said div exactly whose post in my community blog had to be edited!

  16. Leah says

    This is happening to me right now every time I try out a new theme. Only one widget stays on the sidebar and the rest goes to the bottom of the content. But when I go back to my current theme, everything looks okay. I still can’t figure it out. :P

  17. Amy says

    Thank you for this post. I am trying to fix this problem on my website right now. I tried everything mentioned in this post, but I still am having issues. I know a little about websites, but I am at a total loss as to why my top navigation bar is going onto 2 lines and why my sidebar is being pushed to the bottom. My website is not live yet, but here is the website

    Thank you for any help!!

  18. sean says

    Similar problem with my bespoke blog inside my website; side bar slips under the footer if there isn’t enough content to push it down.

    I found that removing (or safer, commenting out) the following sorted the problem:

    I don’t know what this empty div is for & so far it hasn’t adversely affected the blog. Another more obvious reason is due to divs without closing tags – it’s a bit harder to keep track of all your open/closed div tags in WP as the footer & header are removed unlike a standard HTML site.

    • Sean says

      Er, that is commenting out the empty ”delimiter” div at the bottom of various WP pages – it disappeared from my original comment!

  19. Cecilia says

    I have this problem and I can’t solve it (I’ve been trying for several days)

    Here is my site:

    Please, I really need help. Thanks!!!! =)

  20. kathy says

    Since most themes have the proper CSS, I find this is almost always a problem of improperly closed HTML. Usually it occurs on a specific page, because the user has tried to add her own HTML in the post editor and things went wonky from there. Simple error, but can take a long time to debug.

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.