Filter query_posts by tag slug on “Tag Archive” page (when tag is 2 or more words)

I’m using the following to bring up a tag archive page: <?php query_posts( “tag=”. ” . single_tag_title( ”, false ) . ” ); ?> This works perfectly for all tags of one word only, but any tags of more than one word (eg: “tag one”, slug: “tag-one”) do not display. Is it possible to query_posts … Read more

Paginate tags page

If I click a random tag I want the tag page to list only 20 posts that is related to that tag and paginate it. <?php /** * The template for displaying Tag Archive pages. */ get_header(); ?> <div id=”container”> <div id=”content” role=”main”> <h1 class=”page-title”><?php printf( __( ‘Tag Archives: %s’, ‘twentyten’ ), ‘<span>’ . single_tag_title( … Read more

Custom WP_Query for current category (in category.php)?

I’m using a small code to display a tag list for the current categories like below: <?php $custom_query = new WP_Query(‘posts_per_page=-1&category_name=overnachten’); if ($custom_query->have_posts()) : while ($custom_query->have_posts()) : $custom_query->the_post(); $posttags = get_the_tags(); if ($posttags) { foreach($posttags as $tag) { $all_tags[] = $tag->term_id; } } endwhile; endif; $tags_arr = array_unique($all_tags); $tags_str = implode(“,”, $tags_arr); $args = array( … Read more

how to programmatically change post tags

Is there a php function which can add/remove tags of posts? If not how would I do this? I am looking for something like this: add_tag($post_id, ‘tag-name’); remove_tag($post_id, ‘tag-name’); 1 Answer 1 The key function you’re looking for here is wp_set_post_tags(). To add the tag ‘awesome’ to post 98, wp_set_post_tags( 98, array( ‘awesome’ ), true … Read more

How to rename ‘TAG’ to ‘TOPIC’

i want to rename TAG to TOPIC and url it should be to is it possible ? 1 Answer 1 Click on the image to enlarge. The screenshot shows the Permalinks settings screen. To do what you want, specify topic in the Tag base field/box.

Allow AJAX call to other roles than admin

On my website, registered users (subscriber role) can send drafts and, if admins validate them, they are published. I’m trying to add a tag box to frontend editor used to send new posts. To implement the autocomplete feature I’m making an AJAX call to this URL: That works great for an administrator user, but … Read more

Custom post type tag archives don’t work for basic loop?

I have registered a custom post type with the right parameters. By that I mean I have added ‘taxonomies’ => array(‘post_tag’,’category’), I have also tried using register_taxonomy_for_object_type(‘post_tag’, ‘custom-post-type-name’); I have a custom function in my functions.php to load a basic loop using a conditional, along the lines of. function child_maybe_do_grid_loop() { if( is_tag() || is_category() … Read more