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/ (Purchase code hidden if logged out) -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.
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
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.
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 placed
query_posts($query_string. ‘&orderby=meta_value&meta_key=date_value&order=ASC’ );
Hope this helps someone.
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.
The topic ‘Adding a new function for 'post ordering' based on custom field’ is closed to new replies.