Tag Info

Hot answers tagged

7

I'd say the easiest way to do it is use the get_terms_args filter and unset the number limit if the context is right (the AJAX request to get the tag cloud): function wpse_64058_all_tags ( $args ) { if ( defined( 'DOING_AJAX' ) && DOING_AJAX && isset( $_POST['action'] ) && $_POST['action'] === 'get-tagcloud' ) unset( ...


4

You should use pre_get_posts to alter the main query on the home page. With the proper conditional tags and parameters (check WP_Query for available parameters) you can achieve what you need You can do the following to just display posts from a given tag on your homepage add_action( 'pre_get_posts', function ( $query ) { if ( !is_admin() && ...


1

One way to do it is to store the order of the tags as post meta data, using the action set_object_terms which happens to pass the tags in the order they appear on edit, eg in your "functions.php": // Called in admin on updating terms - update our order meta. add_action( 'set_object_terms', function ( $object_id, $terms, $tt_ids, $taxonomy, $append, ...


1

You can use categories with pages by registering the category taxonomy for the page object type: function categories_for_pages(){ register_taxonomy_for_object_type( 'category', 'page' ); } add_action( 'init', 'categories_for_pages' ); If you want to use a separate taxonomy for this, you can register your own taxonomy for pages.


1

The currently logged in user The \WP_User object/instance can be retrieved via: $user = get_current_user(); There's a shortcut API wrapper to fetch the ID: $user_id = get_current_user_id(); $wpdb and the WP "DBAL" WP basically uses $wpdb as DBAL/Database Abstraction Layer. It got plenty of public methods and some higher level wrappers for convenient ...


1

Try give a name for your rewrite, like so: 'rewrite' => array( 'slug' => 'news-updates-archive', 'with_front' => true, 'feeds' => false, 'pages' => true, ) So you will avoid any problem. Also, the last functions you're using are unnecessary. You can setup it on register_post_type: 'taxonomies' => ...


1

Use get_the_tags() instead of the_tags(), get_the_tags() does the following for you: Returns an array of objects, one object for each tag assigned to the post. with which you can work with to achieve what you want. See the examples on the codex page for more information.


1

You're close. Your first attempt is using get_the_tags incorrectly. The function accepts the post ID you want to get the tags from. In your example, there is no $tag global, so $tag->name is trying to fetch a property of a non-object. In your second attempt, a single post won't have any tag-related query vars, that would only be set on a tag archive page ...



Only top voted, non community-wiki answers of a minimum length are eligible