Archive for April, 2011

 

wordpress sort posts by custom field numeric value

Thursday, April 14th, 2011

there is no default option in wordpress to set up sort order of post manually while adding post. Other options are sorting by title or date using query_post() function.  To set up custom sort order we can do this using custom field. Use following code

query_posts(orderby=meta_value&meta_key=sort_order&order=ASC’);

REMEMBER: if you use this function then you have to assign sort_order custom field to each post. Otherwise posts which do not have sort_order custom field will not be displayed.

the_content not responding to the “more tag” outside of WP

Thursday, April 14th, 2011

when used setup_postdata() , the_content ignore more tag

the more tag does not work on custom queries like that.

You can set the global $more variable to either 1 or 0 to turn the more functionality on or off. Do this right before your call to the content:

global $more;
$more = 1;
the_content();

0 means turn on
1 means turn off
Site map | Blog
Copyright © 2008, COG IT Solutions Pvt. Ltd. All Rights Reserved
XHTML Validated