
-
AuthorPosts
-
May 7, 2019 at 2:05 pm #1098075
Hallo,
ich habe mit WooCommerce einen Shop angelegt. Auf jeder Produktseite gibt es oben links und rechts jeweils einen Button mit Pfeil. Wenn man mit der Maus darüber fährt, öffnet sich ein kleines Fenster mit der Vorschau auf das nächste Produkt, das bei Mausklick geöffnet wird.
Meine Frage ist: wie kann ich die Produkte und die Reihenfolge auswählen? Bisher scheint die Produktreihenfolge ziemlich willkürlich.
Danke und viele GrüßeMay 10, 2019 at 11:33 pm #1099441Hey Oliver,
Can you please post in English?
Best regards,
BasilisMay 13, 2019 at 12:01 pm #1100017Hi Basilis,
ok, I will try.
I have started a shop with WooCommerce. At the top of every product-page there are 2 buttons on the left and right side with an arrow. Going with the mouse over the button, a window is opening that shows a product-page that opens when clicking on it.
My question is: how can I decide the order of the products? Now it is not the order of the products in the menu.
Thanks and best regards,
OliverMay 14, 2019 at 7:56 am #1100393Hi Oliver,
This is the WordPress post nav in action. You can read more about it here
https://codex.wordpress.org/Next_and_Previous_Links
https://wordpress.stackexchange.com/questions/73190/can-the-next-prev-post-links-be-ordered-by-menu-order-or-by-a-meta-keyBest regards,
VictoriaMay 15, 2019 at 1:47 pm #1101040Hi Victoria,
thank you.
Unfortunately I can not find an answer to my question in these articles.
Can you tell me, how I can decide the order of the products?
Thanks and best regards,
OliverMay 18, 2019 at 9:12 pm #1102089Hi Oliver,
Please have a look at this thread:
If you need further assistance please let us know.
Best regards,
VictoriaMay 21, 2019 at 1:04 pm #1102843Hi Victoria,
thank you. Unfortunately I can not find a solution for my problem. Could you maybe answer to my question for yourself or is my problem very complicated? Thanks.
Best regards
OliverMay 27, 2019 at 2:55 am #1104385Hi,
Sorry for the confusion.
The post or product navigation is created using the “get_adjacent_post” function and as the name suggests, it retrieves the next/previous post. The default order is by date, but you can use the “get_{$adjacent}_post_sort” filter to change it. The $adjacent refers to the type of adjacency, which is either “next” or “previous”.
Example:
function avf_get_previous_post_sort_mod( $sort ) { if ( 'product' === get_post_type() ) return "ORDER BY p.post_title DESC LIMIT 1"; else return $sort; } add_filter( 'get_previous_post_sort', 'avf_get_previous_post_sort_mod' );
That should sort the previous post by title instead of date.
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.