I have added a new function into lots_of_small_helpers.php. It basically checks which category the post is in and if it is in a particular one it orders them by customer field (thank you to http://esdev.net/sort-events-by-date-in-wordpress-using-custom-fields/).
I would like to verify that within the Newscast theme it is ok to place it in that lots_of_small_helpers.php or should I place it in the functions.php.
Many thanks
Adding a new function for 'post ordering' based on custom field
8 posts from 4 voices-
Posted 2 years ago #
-
You can copy and paste your code in every file you like - you can even create a new php file but don't forget to include it. I prefer to paste custom functions and filters into functions.php but you can also use lots_of_small_helpers.php
Posted 2 years ago # -
I would love to know what Helen put in her functions.php file to get the posts to reorder by a date in the custom fields panel.
Posted 2 years ago # -
It seems that the link above doesn't work anymore... :-(
Posted 2 years ago # -
Hi,
I actually did in a completely different way.
1. I created a post emaplte for the category I was working on.
2. I installed the plugin 'Date Field' http://matth.eu/wordpress-date-field-plugin. This enables a custom field to be created for your post with a date/time format.
3. Just before the loop I placedglobal $query_string;
query_posts($query_string. '&orderby=meta_value&meta_key=date_value&order=ASC' );Hope this helps someone.
Posted 2 years ago # -
Thanks Helen for sharing your code here.
Posted 2 years ago # -
Nice! Is she still putting this code into the functions.php file? What does she mean by "just before the loop"? Can you be specific where this code goes, thanks.
Posted 1 year ago # -
Posted 1 year ago #
Topic Closed
This topic has been closed to new replies.














