Month: July 2013
Adding Taxonomy Filter to Admin posts List for Custom Post Type
在 wordpress 默认的文章 class TerminQuery{ public function __construct() { add_filter(‘parse_query’,array($this, ‘query’)); add_action(‘restrict_manage_posts’,array($this, ‘restrict’)); } function query($query) { global $pagenow; global $typenow; $qv = &$query->query_vars; if ($typenow!=’post’ && $pagenow==’edit.php’) { $taxonomies = get_object_taxonomies($typenow); foreach ($taxonomies as $taxonomy) { if (isset($qv[$taxonomy]) && is_numeric($qv[$taxonomy])) { $term = get_term_by(‘id’,$qv[$taxonomy],$taxonomy); $qv[$taxonomy] = ($term ? $term->slug : ”); } } }…
定制 WordPress 的默认 Query
One of the most powerful features of WordPress is the WP Query. It is what determines what content is displayed on what page. And often you’ll want to modify this query to your specific needs. Some examples: Don’t display posts from Category X on the homepage Increase or decrease the number of posts displayed per…