Community Forums › Forums › Archived Forums › Design Tips and Tricks › How can I manually change posts order in my homepage?
- This topic has 5 replies, 3 voices, and was last updated 7 years ago by Brad Dalton.
-
AuthorPosts
-
April 13, 2017 at 1:45 am #204713swann83Member
Hi,
I am using Genesis' Magazine Pro theme, as a beginner essentially. I know that posts in WP are shown from the most recently published, but I need to change posts order in my homepage without changing the published date. How can I manually change that order?I've also tried to install "Post Types Order" plugin but I can't get the ReOrder interface trough which the sort can be created. When I click on "ReOrder" at the bottom of posts section, I only get a blank page after a while. I think it's a problem related to Genesis – or specifically Magazine Pro theme – compatibility. Any suggestion?
Thanks to all of you.
April 13, 2017 at 3:10 am #204719Victor FontModeratorThe plugin you are trying to use if for custom post types you have defined, not built-in WordPress post types. This is from the plugin website: "You can sort ALL post types that you have defined into your WordPress as long they are not hierarchically defined"
To change the order of posts in a query, you need to change the query's "order by" through the WordPress posts_orderby filter. https://codex.wordpress.org/Plugin_API/Filter_Reference/posts_orderby
The following code sorts posts alphabetically by title:
//* Sort the portfolio thumbnails alphabetically add_filter("posts_orderby", "vmf_orderby_filter", 10, 2); function vmf_orderby_filter($orderby, &$query){ global $wpdb; //figure out whether you want to change the order if (get_query_var("post_type") == "post") { return "$wpdb->posts.post_title ASC"; } return $orderby; }
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?April 13, 2017 at 3:31 am #204721swann83MemberThank you for the answer. Well, I don't need a different sorts parameter. I just need a kind of drag and drop feature to re-order my posts arrangement day by day, without changing date – 'cause this would change permalink and produce lost pages and disadvantage in organic search results. I remember a drag and drop feature like that, used in newspaper magazine website (built in WP) I worked for.
April 13, 2017 at 4:20 pm #204752Victor FontModeratorDragging and dropping posts on the back end will have absolutely no bearing on how posts are displayed on the back end. You may have seen a custom feature of some king, but that kind of functionality does not exist in WordPress or Genesis. Good luck in your search.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?April 14, 2017 at 12:08 am #204769swann83MemberThat drag & drop feature actually exists in "Post Types Order" plugin, but it doesn't seem to work with Genesis.
April 16, 2017 at 8:44 am #204850Brad DaltonParticipantWorks. Just tested it using the Metro Pro theme. No problems.
Note: You can use menu_order with a custom query if you want to hand code it.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.