Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1918

    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

    #36223

    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

    #36224

    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.

    #36225

    It seems that the link above doesn’t work anymore… :-(

    #36226

    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 placed

    global $query_string;

    query_posts($query_string. ‘&orderby=meta_value&meta_key=date_value&order=ASC’ );

    Hope this helps someone.

    #36227

    Thanks Helen for sharing your code here.

    #36228

    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.

    #36229
Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘Adding a new function for 'post ordering' based on custom field’ is closed to new replies.