Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- in functions.php
- function list_all_agent_posts() {
- // Configuration
- $transName = 'tr-agent-posts'; // Name of value in database.
- $cacheTime = 720; // Time in minutes between updates.
- // Do we already have a saved transient?
- $agent_posts = get_transient($transName);
- // If not, lets get one.
- if($agent_posts === false):
- $agent_posts = new WP_Query(array('post_type' => 'agent', 'order' => 'ASC', 'orderby' => 'title'));
- // Save our new transient.
- set_transient($transName, $agent_posts, 60 * $cacheTime);
- endif;
- // send back the result.
- return $agent_posts;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement