By Anonymous (not verified) on
Hi,
I am using:
node_load_multiple(array(), array('type' => 'products'));
which returns an array of products and works ok. Is there any way i can sort it by added date?
Thanks,
Pav
Hi,
I am using:
node_load_multiple(array(), array('type' => 'products'));
which returns an array of products and works ok. Is there any way i can sort it by added date?
Thanks,
Pav
Comments
As the api for
As the api for node_load_multiple() explains, the conditions parameter is depreciated. So you should first use EntityFieldQuery to retrieve a list of entity IDs loadable by this function. Use EntityFieldQuery to build your query and order the results.
eg:
This returns the last 5 published nodes of types article, page and blog. Then you can use these returned nid's to load them each using node_load_multiple().
See here for another example: http://drupal.org/node/916776#comment-4191166
Just one more detail
The final line of code for this is:
node_load_multiple sort by custom field
This should do the trick
Please try this also will
Please try this also will help