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 ordnar du enkelt om posts i WordPress (steg för steg)

Ibland behöver du mer kontroll över hur dina blogginlägg ska ordnas. Vi har själva varit där och försökt lyfta fram ett viktigt tillkännagivande, visa upp en tävling eller presentera en viktig uppdatering.

Som standard visar WordPress dina inlägg i omvänd kronologisk ordning, med de nyaste högst upp. Även om detta fungerar bra för det mesta, kan det vara frustrerande när du behöver prioritera visst innehåll.

Det är därför vi har sammanställt den här guiden. Vi går igenom flera metoder för att ordna om dina WordPress-inlägg, från snabba och enkla knep till mer avancerade tekniker.

How to Arrange WordPress Posts and Custom Posts Using Drag & Drop

Varför omordna blogginlägg i WordPress?

Ibland kan det finnas specifikt content som du vill att besökarna ska se först. Du kanske till exempel vill fästa en blogg med ett stort tillkännagivande på front page, bloggsidan, senaste inlägg eller archive pages.

Du kan också behöva manuellt omordna custom post types. Om du till exempel har skapat en WooCommerce store, kanske du vill visa dina mest populära produkter först eller objekt som är på rea.

Problemet är att WordPress normalt visar dina blogginlägg i omvänd kronologisk ordning (de senaste inläggen till de minsta), utan något enkelt sätt att flytta ett inlägg uppåt eller nedåt. Även om du anpassar Query Loop-blocket i blockredigeraren eller redigeraren för hela webbplatsen ger det dig begränsade omordningsalternativ.

The reordering options in the Query Loop block

Med det i åtanke, låt oss titta på några lösningar och tricks som kan hjälpa dig att enkelt ordna om blogginlägg, WooCommerce-produkter och mer. Använd bara snabblänkarna under för att hoppa direkt till den metod du vill använda:

Video Tutorial

Subscribe to WPBeginner

Metod 1: Ändra postens publicerade datum (snabbt och enkelt)

Det enklaste sättet att ändra ordern på dina posts är att helt enkelt ändra det publicerade datumet.

Som standard visar din WordPress site inlägg baserat på deras publiceringsdatum i omvänd kronologisk order, så nyare inlägg visas först.

Att ändra ett posts publiceringsdatum kommer också att ändra var det visas på din archive page, blogg page och andra areas på din WordPress website.

Examples of published dates on blog posts

Om du till exempel vill visa ett äldre inlägg först kan du ändra dess publiceringsdatum till idag. På samma sätt, om du vill flytta ett inlägg nedåt i listan, kan du helt enkelt göra dess publiceringsdatum äldre.

För att göra detta öppnar du bara blogginlägget i WordPress blockredigerare. I det högra sidofältet navigerar du till fliken ”Inlägg” och klickar sedan på länken bredvid ”Publicera”.

Detta öppnar en popup med datum och tid där du kan ändra publiceringsdatumet.

Updating a blog post's publishing date in the block editor

Här är det viktigt att välja ett datum som är relevant för andra posts. Om du till exempel vill att inlägget ska visas före en blogg som publicerades den 8 mars måste du ändra publiceringsdatumet till den 9 mars.

När du har ändrat datum och tid klickar du på ”Update” för att spara dina ändringar.

Metod 2: Använd Plugin för beställning av inläggstyper (mer kontroll)

Om du vill ordna om posterna utan att ändra deras publiceringsdatum, rekommenderar vi att du använder Post Types Order. Detta plugin allow you to organize blog posts, WooCommerce products, coupon codes, orders, custom post types, and more using drag and drop.

Först måste du installera och aktivera pluginet Post Types Order. För mer detaljer, se vår Step-by-Step guide om hur du installerar ett plugin för WordPress.

Efter aktivering, heada över till Settings ” Post Types Order page för att konfigurera plugin-inställningarna.

Opening the Post Types Order plugin settings

Avsnittet ”Show / Hide re-order interface” listar alla de olika content typer som Post Types Order kan omorganisera.

Du måste se till att dessa dropdown-menyer är inställda på ”Show”.

Choosing what post types should the Post Types Order plugin work on

Därefter rullar du till ”Archive Drag & Drop” -sektionen.

För varje content type som du vill omorganisera öppnar du dropdown-menyn och väljer ”Yes”.

Configuring the Post Types Order plugin settings

När du är nöjd med hur pluginet är konfigurerat klickar du på ”Save Settings”.

Nu går du till ett area med det content du vill ordna om, till exempel Posts ” All Posts. Du kan sedan skapa en custom order genom att helt enkelt dra and drop posterna till nya positioner.

Re-Order blog posts by drag and drop

Metod 3: Använd dra och släpp i WooCommerce (produktposttyper)

Om du run en online store, då WooCommerce redan stöder drag and drop nativt.

To reorder your products, you must go to the Products ” All Products page.

Re-ordering WooCommerce products in WordPress

Här klickar du på länken ”Sorting” högst upp på page.

Du kan sedan ändra ordern på dina produkter med hjälp av drag and drop.

WooCommerce Natively Supports Drag and Drop

Är du nöjd med hur produkterna är organiserade i din webbutik?

Sedan klickar du bara på länken ”All” för att sluta sortera.

Stop reorganizing WooCommerce products

Metod 4: Gör WordPress Posts Sticky (Bäst för att markera specifika inlägg)

Ibland kanske du vill lyfta fram ett viktigt blogginlägg, t.ex. ett stort produktmeddelande eller ett inlägg om en giveaway eller tävling som you run.

WordPress allow you to make a post sticky so that it appears above all the other posts on your blogginlägg page, no matter what the publication date.

För att göra detta öppnar du helt enkelt det blogginlägg i WordPress som du vill markera. I menyn ”Post” markerar du boxen bredvid ”Klistra till högst upp i bloggen”.

Making posts sticky in WordPress

Efter det klickar du på knappen ”Update” för att save your changes.

Nu, om du besöker din website, kommer du att se inlägget fäst högst upp. Det fast)klistrade inlägget kan till och med markeras på olika sätt, beroende på ditt WordPress theme.

För mer detaljerade instruktioner, se dessa guider:

Metod 5: Omordna WordPress Posts med hjälp av kod (avancerad)

Du kanske vill ändra hur WordPress organiserar alla posts på din website, inklusive alla posts som du kan komma att publicera i framtiden. Det bästa sättet att göra detta är att lägga till custom code i WordPress.

Ofta hittar du guider med instruktioner för att editera ditt temas functions.php-fil. Detta kan dock orsaka alla möjliga vanliga WordPress error eller till och med förstöra din site helt.

Du kommer också att förlora customize när du uppdaterar ditt WordPress theme.

Istället rekommenderar vi att du använder gratispluginet WPCode. WPCode är det bästa, mest nybörjarvänliga kodsnuttspluginet som används av över 1 miljon WordPress-webbplatser. Det gör att du enkelt kan lägga till anpassad CSS, HTML, PHP och mer utan att riskera din webbplats.

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

Efter aktivering, head över till Code Snippets ” Add Snippet.

Adding a code snippet to WordPress

Här håller du bara muspekaren över ”Add Your Custom Code”.

När det dyker upp måste du klicka på ”Use snippet”.

Reorganizing WordPress posts using WPCode

Till att börja med skriver du in en titel för det anpassade code snippet. Det kan vara vad som helst som hjälper dig att identifiera snippet i WordPress dashboard.

Efter det öppnar du dropdown ’Code Type’ och väljer ’PHP Snippet’.

Reorganizing WordPress posts using WPCode

I code editor, add to följande code snippet:

//function to modify default WordPress query
function wpb_custom_query( $query ) {
  
// Make sure we only modify the main query on the homepage  
    if( $query->is_main_query() && ! is_admin() && $query->is_home() ) {
  
        // Set parameters to modify the query
        $query->set( 'orderby', 'date' );
        $query->set( 'order', 'ASC' );
    }
}
  
// Hook our custom query function to the pre_get_posts 
add_action( 'pre_get_posts', 'wpb_custom_query' );

Denna kod ändrar helt enkelt parametrarna orderby och order i standard WordPress sökning.

I snippet ovan visar vi inlägg i kronologisk order så att de äldre inläggen visas först. Parametern orderby har dock många alternativ, så du kan ordna dina posts på många olika sätt.

Du kan se en fullständig lista över alternativ genom att besöka WP Query-kodreferensen.

Här är ett annat kodexempel, där vi ändrade ordningen genom en helt slumpmässig ordning:

// Function to modify default WordPress query
function wpb_custom_query( $query ) {
  
    // Make sure we only modify the main query on the homepage  
    if( $query->is_main_query() && ! is_admin() && $query->is_home() ) {
  
        // Set parameters to modify the query
        $query->set( 'orderby', 'rand' );
    }
}
  
// Hook our custom query function to the pre_get_posts 
add_action( 'pre_get_posts', 'wpb_custom_query' );

När du är nöjd med snippet måste du rulla till ”Insertion” -sektionen. WPCode kan add din kod till olika locations, såsom efter varje post, endast front-end eller endast admin.

Vi vill använda den customize PHP-koden på hela vår WordPress website, så click på ”Auto Insert” om den inte redan är vald.

Öppna sedan dropdown för ”Location” och välj ”Run Everywhere”.

Run code snippet across WordPress website

Efter det är du redo att rulla högst upp på vyn och klicka på ”Inaktiverad” toggle så att den ändras till ”Aktiv”.

Slutligen klickar du på ”Save Snippet” för att göra PHP snippet live.

Re-order posts in WordPress using WPCode

Nu, om du besöker din site, kommer du att se att posterna har omorganiserats baserat på din kod.

Vi hoppas att den här artikeln hjälpte dig att lära dig enkla sätt att ordna om blogginlägg i WordPress. Du kanske också vill se våra expertval för de bästa relaterade inlägg-pluginsen för WordPress och hur du lägger till en knapp för att ladda fler inlägg i WordPress.

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

51 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. Mrteesurez says

    Nice one, you know what, this post reordering is useful to as I have an educational website where I showed blog post in order of publishing date with as lessons after each other. I found it difficult to manually edit the post to change the date, so this solves the problem. thanks.

  3. Jiří Vaněk says

    Is there some way, eg using CSS, to highlight a post that is pinned to the top of the blog like this? For example, a different background color of the block, etc.? The currently used template cannot do this.

  4. Olivier says

    For some reasons, the drag-and-drop options for Products did not work for me, and I did not want to install another plugin…

    So I found a workaround to display my products for one specific category, by using the default woocommerce shortcode with the order attribute.

    [products columns=”3″ category=”some-category-goes-here” order=”ASC”]

    Now my producs for this category are display from first to last (which happened to be in my case with ascending price, which is what I wanted), and from not last to first.

    Somehow a 6th method, to update your post with. ;-)

    Hope this helps.

    • WPBeginner Support says

      The simplest method from this that would affect your blog page would be to change the published date for your blog posts :)

      Administratör

  5. Jeff Moyer says

    Wow fantastic article thank you, I was aware of a couple of these options but not all thank you! Probably going to avoid the coding option but we’ll see lol.

  6. Brian says

    I have the post reorder plugin, but do you know if there’s a plugin that allows the write to choose the post priority while in edit? For example, a dropdown that allows the user to select where on the page the post should appear (first, fifth, 10th, etc.).

  7. mark says

    First of all thank you for putting this together, your post are usually very helpful.

    For some reason the theme i’m using has the blog posts order with oldest post on top. I would like to see the newest on top.

    I’m running out of ideas. Any idea what to look for (and where) to get my posts sorted with the newest post on top?

    • WPBeginner Support says

      You would want to reach out to the support for your specific theme for if this is a theme setting.

      Administratör

  8. Tom Grisak says

    Thanks for the help. I didn’t know a plugin could do that for me. I thought I’d have to go to every post and change the publish date. But I have a question, it sounds like you can put two stickies at the top. Are those also sorted by date?

  9. Rico says

    What I would like is for the sticky post to be at the top and the rest of the posts to follow the default (reverse chronological) order below it. I’ve used the sticky option but it doesn’t always put the sticky post at the top. It’s sticky on the blog page but at the bottom of the list in the sidebar for Recent Blog Posts. I’m using the Alizee template. Is there something I can do with CSS or another method to achieve this for both areas?

  10. dirkthewebphoenix says

    What about a merely temporary reversal of order?

    Example: As a visitor you have a special interest making you want to start with the oldest posts in your search, or as the site author you want to create a search URL for your menu that will present a popular post series in chronological order.

    Is there any search term one could enter to reverse the order or any modification of the search URL (get request) that would do this on this one-time basis?

    • WPBeginner Support says

      For that, you would need to look into a plugin for your search to allow that type of one time re-order

      Administratör

  11. Phil Smart says

    When ordering and displaying blog posts, my sponsor wants them ordered by the date of the event, which is the only reliable date. I am asking how to make that happen.

    My sponsor considers that altering the date published just to alter the order means that no-one can count on that date to know which version of posts they are looking at.

    How can we add a field to capture event-date?

  12. Michael Walther says

    Unfortunately, drag-and-drop type plugins like ’Post Types Order’ are completely useless if you have more posts in your blog than fit on one screen.

    For instance, I have > 100 posts in my blog. If I want so drag, say, post #96 all the way up to position #3, then I am out of luck because #5 and #96 do not fit on the same screen, which makes drag and drop impossible.

    • WPBeginner Support says

      If you go to your screen options in the top right of your All Posts page and you should be able to increase the number of posts to display on the page :)

      Administratör

  13. Jo Wagner says

    Hi there,

    I like this plugin. But find it limiting to only post types and not Pages as well. Simple Page Order works well for pages, but then you have two plugins again, which is not ideal. Is there no plugin to be able to do both?

    Please let me know.

  14. Abe says

    Hi there, I’m using the WordPress.com free blog, and when I clicked on plug-ins, it’s asking me to upgrade. Is there another way of installing the re-order word press posts? Any tips would be great. I was planning on including my previously done writings, which weren’t done in this blog, but in review sites like Trip Advisor or Zomato, but the tendency of the site is that my latest posts will be the ones posted on top, so the chronological thing works only if I write my posts also based on timing of the visit, which is not feasible of how I’m going to populate my blog post.

  15. Donna L Lovette says

    I downloaded the post oder plugin and I worked perfectly. Now my blog looks like I want it to. Thanks

  16. Sherry says

    Hi – I installed the post order plug in and reordered my posts but it didn’t change the order on the site. what am I doing incorrectly?

  17. Lee Grainger says

    I have uploaded this plugin, dragged and dropped my posts in the order I want them in, but they don’t appear to have changed.
    I have several blog post categories on different pages, is it possible this is the reason?

  18. Laura Sage says

    I’ve used this plugin many times. Very useful. Thank you. HOWEVER, I just created a custom post type, and the re-oder option isn’t showing up for it. What do I need to do in order for it to be added to my custom post type as well? The custom post type doesn’t show up in Settings.

  19. Neooth says

    This plugin is amazing. But I have a question: On my front page, I’ve got a combined archive of multiple post types. Whenever I change the order of the posts/custom posts, oddly, an old post from a custom post type springs to the top.

    I am guessing this happens because when I use the plugin, the rearrangement is done according to the ID, and ID’s from all custom post types start vying with each other.

    Is there a way to prevent an old custom post type with an ID of 0 from appearing near the top?

  20. Ankur says

    Useful plugin, might use it on my site.
    Also, I like new layout of the site. Is it some customized genesis child theme of some completely different customized theme for your site ?

  21. bill says

    Wow! Wish I would’ve known about this plugin three months ago. When working on a client’s site, I had to re-date over three hundred posts; not a fun gig :) Thanks for the article.

  22. Kathy Drewien says

    I noticed the plugin shows compatibility only up to WP 3.2.2, yet it was updated 11 days ago. Any known issues with 3.3 and higher?

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.