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

Jak łatwo zmienić kolejność wpisów w WordPress (krok po kroku)

Uwaga redakcyjna: Otrzymujemy prowizję z linków partnerskich na WPBeginner. Prowizje nie mają wpływu na opinie i oceny naszych redaktorów. Dowiedz się więcej o Proces redakcyjny.

Chcesz zmienić kolejność wpisów na blogu w WordPress?

Domyślnie WordPress wyświetla wpisy na Twoim blogu odwiedzającym w odwrotnej kolejności chronologicznej, więc nowsze wpisy pojawiają się jako pierwsze. Czasami jednak możesz chcieć zmienić tę kolejność i nadać priorytet różnym treściom.

W tym artykule podzielimy się najprostszym sposobem na zmianę kolejności wpisów na blogu WordPress, produktów WooCommerce i własnych typów treści.

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

Dlaczego warto zmienić kolejność wpisów na blogu WordPress?

Czasami może istnieć określona treść, którą odwiedzający powinni zobaczyć w pierwszej kolejności. Na przykład, możesz chcieć przypiąć duże ogłoszenie na blogu do strony głównej, strony bloga, ostatnich wpisów lub strony archiwum.

Konieczna może być również ręczna zmiana kolejności własnych typów treści. Na przykład, jeśli utworzyłeś sklep WooCommerce, możesz chcieć najpierw pokazać swoje najpopularniejsze produkty lub produkty, które są w sprzedaży.

Problem polega na tym, że WordPress zwykle wyświetla twoje wpisy na blogu w odwrotnej kolejności chronologicznej, bez łatwego sposobu na przeniesienie wpisu w górę lub w dół.

Mając to na uwadze, przyjrzyjmy się kilku obejściom i sztuczkom, które mogą pomóc w łatwej zmianie kolejności wpisów na blogu, produktów WooCommerce i nie tylko. Skorzystaj z poniższych odnośników, aby przejść bezpośrednio do wybranej metody:

Film instruktażowy

Subscribe to WPBeginner

Metoda 1: Zmiana daty publikacji wpisu (szybko i łatwo)

Najprostszym sposobem na zmianę kolejności twoich wpisów jest po prostu zmiana daty publikacji.

Domyślnie twoja witryna WordPress wyświetla wpisy na podstawie daty ich publikacji w odwrotnej kolejności chronologicznej, więc nowsze wpisy pojawiają się jako pierwsze.

Zmiana daty publikacji wpisu spowoduje również zmianę miejsca jego wyświetlania na twojej stronie archiwum, stronie bloga i innych obszarach witryny internetowej WordPress.

Examples of published dates on blog posts

Na przykład, jeśli chcesz wyświetlić starszy wpis jako pierwszy, możesz zmienić jego datę publikacji na dzisiejszą. Podobnie, jeśli chcesz przesunąć wpis w dół listy, możesz po prostu zmienić jego datę publikacji na starszą.

Aby to zrobić, wystarczy otworzyć wpis na blogu w edytorze treści WordPress w prawym panelu bocznym, przejść do karty „Wpis”, a następnie kliknąć odnośnik obok „Opublikuj”.

Spowoduje to otwarcie wyskakującego okienka z datą i godziną, w którym można zmienić datę publikacji.

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

Tutaj ważne jest, aby wybrać datę, która jest istotna dla innych wpisów. Na przykład, jeśli chcesz, aby wpis pojawił się przed blogiem opublikowanym 8 marca, musisz zmienić datę jego publikacji na 9 marca.

Po zmianie daty i godziny kliknij „Aktualizuj”, aby zapisać twoje zmiany.

Metoda 2: Użyj wtyczki Post Types Order (najlepsza dla własnych typów treści)

Jeśli chcesz zmienić kolejność wpisów bez zmiany daty ich publikacji, zalecamy skorzystanie z opcji Post Types Order. Wtyczka ta umożliwia organizowanie wpisów na blogu, produktów WooCommerce, kodów kuponów, zamówień, własnych typów treści i innych za pomocą przeciągania i upuszczania.

Najpierw należy zainstalować i włączyć wtyczkę Post Types Order. Aby uzyskać więcej informacji, zapoznaj się z naszym przewodnikiem krok po kroku, jak zainstalować wtyczkę WordPress.

Po włączaniu należy przejść do strony Ustawienia ” Zamawianie typów treści, aby skonfigurować ustawienia wtyczki.

Post Types Order settings

Sekcja „Pokaż / ukryj interfejs zmiany kolejności” zawiera listę wszystkich różnych typów treści, które Post Types Order może reorganizować.

Musisz upewnić się, że te rozwijane menu są ustawione na „Pokaż”.

Reorganizing blog posts and custom post types in WordPress

Następnie przewiń do sekcji „Przeciągnij i upuść archiwum”.

Dla każdego rodzaju treści, który chcesz zreorganizować, otwórz jego menu rozwijane i wybierz „Tak”.

Enabling the reordering feature for posts and custom post types in WordPress

Gdy będziesz zadowolony z konfiguracji wtyczki, kliknij „Zapisz ustawienia”.

Teraz przejdź do obszaru z treścią, której kolejność chcesz zmienić, takiego jak Wpisy ” Wszystkie wpisy. Następnie możesz utworzyć własny porządek, po prostu przeciągając i upuszczając wpisy na nowe pozycje.

Re-Order blog posts by drag and drop

Metoda 3: Przeciągnij i upuść w WooCommerce (bez dodatkowych wtyczek)

Jeśli prowadzisz sklep internetowy, to WooCommerce już natywnie obsługuje funkcję przeciągnij i upuść.

Aby zmienić kolejność twoich produktów, musisz przejść do strony Produkty ” Wszystkie produkty.

Re-ordering WooCommerce products in WordPress

Tutaj kliknij odnośnik „Sortowanie” u góry strony.

Następnie możesz zmienić kolejność twoich produktów metodą „przeciągnij i upuść”.

WooCommerce Natively Supports Drag and Drop

Jesteś zadowolony z tego, jak zorganizowane są produkty w Twoim sklepie internetowym?

Następnie wystarczy kliknąć odnośnik „Wszystkie”, aby zatrzymać sortowanie.

Stop reorganizing WooCommerce products

Metoda 4: Przypięte wpisy WordPress (najlepsze do wyróżniania konkretnych wpisów)

Czasami możesz chcieć wyróżnić ważny wpis na blogu, taki jak zapowiedź dużego produktu lub wpis o rozdaniu lub konkursie, który prowadzisz.

WordPress pozwala na przypięcie wpisu tak, aby pojawiał się nad wszystkimi innymi wpisami na stronie twojego bloga, bez względu na datę publikacji.

Aby to zrobić, po prostu otwórz wpis na blogu WordPress, który chcesz wyróżnić. W menu „Wpis” zaznacz pole obok opcji „Przyklej na górze bloga”.

Making posts sticky in WordPress

Następnie kliknij przycisk „Aktualizuj”, aby zapisać twoje zmiany.

Teraz, jeśli użytkownik przejdzie na twoją witrynę internetową, zobaczy wpis przypięty na górze. Przypięty wpis może być nawet inaczej wyróżniony, w zależności od twojego motywu WordPress.

Aby uzyskać bardziej szczegółowe instrukcje, zapoznaj się z naszym przewodnikiem na temat tworzenia przypiętych wpisów.

Metoda 5: Zmiana kolejności wpisów w WordPressie za pomocą kodu (dla zaawansowanych)

Możesz chcieć zmienić sposób, w jaki WordPress organizuje wszystkie wpisy w twojej witrynie internetowej, w tym wszelkie wpisy, które możesz opublikować w przyszłości. Najlepszym sposobem na to jest dodanie własnego kodu w WordPress.

Często można znaleźć przewodniki z instrukcjami edycji pliku functions.php twojego motywu. Może to jednak powodować różnego rodzaju typowe błędy WordPressa, a nawet całkowicie zepsuć twoją witrynę.

Utracisz również konfigurator, gdy zaktualizujesz swój motyw WordPress.

Zamiast tego zalecamy skorzystanie z darmowej wtyczki WPCode. WPCode to najlepsza, najbardziej przyjazna dla początkujących wtyczka do fragmentów kodu, z której korzysta ponad milion witryn internetowych WordPress. Umożliwia ona łatwe dodawanie własnych CSS, HTML, PHP i innych bez narażania twojej witryny na ryzyko.

Pierwszą rzeczą, którą musisz zrobić, jest zainstalowanie i włączanie WPCode. Aby uzyskać więcej informacji, zobacz nasz przewodnik krok po kroku, jak zainstalować wtyczkę WordPress.

Po włączaniu udaj się do Code Snippets ” Add Snippet.

Adding a code snippet to WordPress

Tutaj wystarczy najechać kursorem myszy na „Dodaj własny kod”.

Gdy się pojawi, należy kliknąć „Użyj fragmentu kodu”.

Reorganizing WordPress posts using WPCode

Na początek wpisz tytuł własnego fragmentu kodu. Może to być cokolwiek, co pomoże zidentyfikować fragment kodu w kokpicie WordPress.

Następnie otwórz listę rozwijaną „Rodzaj kodu” i wybierz „Fragment kodu PHP”.

Reorganizing WordPress posts using WPCode

W edytorze kodu dodaj następujący fragment kodu:

//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' );

Ten kod po prostu modyfikuje parametry orderby i order w domyślnym zapytaniu WordPress.

W powyższym fragmencie kodu wyświetlamy wpisy w porządku chronologicznym, więc starsze wpisy pojawiają się jako pierwsze. Jednak parametr orderby ma wiele opcji, więc możesz uporządkować swoje wpisy na wiele różnych sposobów.

Pełną listę opcji można zobaczyć przechodząc na stronę WP Query code reference.

Gdy jesteś zadowolony z fragmentu kodu, musisz przewinąć do sekcji „Wstaw”. WPCode może dodać twój kod do różnych miejsc, takich jak po każdym wpisie, tylko frontend lub tylko administrator.

Chcemy użyć własnego kodu PHP na całej naszej witrynie internetowej WordPress, więc kliknij „Auto Insert”, jeśli nie jest jeszcze wybrany.

Następnie otwórz menu rozwijane „Lokalizacja” i wybierz „Uruchom wszędzie”.

Run code snippet across WordPress website

Następnie możesz przewinąć do góry ekranu i kliknąć przełącznik „Nieaktywne”, aby zmienił się na „Aktywne”.

Na koniec kliknij „Zapisz fragment”, aby uruchomić fragment kodu PHP.

Re-order posts in WordPress using WPCode

Teraz, jeśli przejdziesz na swoją witrynę, zobaczysz, że wpisy zostały zreorganizowane na podstawie twojego kodu.

Mamy nadzieję, że ten artykuł pomógł ci poznać proste sposoby na zmianę kolejności wpisów na blogu w WordPress. Zachęcamy również do zapoznania się z naszymi eksperckimi typami najlepszych wtyczek SEO do WordPressa lub naszym przewodnikiem na temat tego, jak zwiększyć ruch na twoim blogu.

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.

Ujawnienie: Nasze treści są wspierane przez czytelników. Oznacza to, że jeśli klikniesz na niektóre z naszych linków, możemy otrzymać prowizję. Zobacz jak WPBeginner jest finansowany, dlaczego to ma znaczenie i jak możesz nas wspierać. Oto nasz proces redakcyjny.

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.

Najlepszy zestaw narzędzi WordPress

Uzyskaj BEZPŁATNY dostęp do naszego zestawu narzędzi - zbiór produktów i zasobów związanych z WordPressem, które każdy profesjonalista powinien mieć!

Reader Interactions

50 komentarzyZostaw odpowiedź

  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

    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.

  3. 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 :)

      Administrator

  4. 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.

  5. 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.).

  6. 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.

      Administrator

  7. 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?

  8. 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?

  9. 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

      Administrator

  10. 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?

  11. 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 :)

      Administrator

  12. 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.

  13. 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.

  14. 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?

  15. 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?

  16. 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.

  17. 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?

  18. 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 ?

  19. 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.

  20. 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?

Zostaw odpowiedź

Dziękujemy za pozostawienie komentarza. Pamiętaj, że wszystkie komentarze są moderowane zgodnie z naszymi polityka komentarzy, a Twój adres e-mail NIE zostanie opublikowany. NIE używaj słów kluczowych w polu nazwy. Przeprowadźmy osobistą i konstruktywną rozmowę.