Articles of get the tags

How can i order get_the_tags?

I have the following code which works exactly as i’d like it to, but the displayed tags are in reverse alphabetical order and i’m not sure how to sort. I’ve noticed that the_tags has an argument called “order” that allows ordering, but get_the_tags does not. Is this because i stored the tags (when adding them […]

wordpress str_replace the content with tag

it is possible to find tag in the content and replace with link? function replace_content($content){ foreach(get_the_tags() as $tag) { $out .= $tag->name .’,’; $csv_tags .= ‘”<a href=”/’ . $tag->slug . ‘”>’ . $tag->name . ‘</a>”‘; } $find = array($out); $replace = array($csv_tags); $content = str_replace($find, $replace, $content); return $content; } add_filter(‘the_content’, ‘replace_content’);

Include tags from array, ignore the rest in get_the_tags

I’m trying to exclude a large amount of tags from being displayed in get_the_tags function. I have successfully excluded tags using this code: <?php $links = array(); foreach (get_the_tags() as $this_tag) { if ($this_tag->name != “test1” && $this_tag->name != “test2″){ $links[] = ‘<a href=”‘.get_tag_link($this_tag->term_id).'” title=”‘.$this_tag->name.'”>’.$this_tag->name.'</a>’; } } echo implode(‘ • ‘, $links); ?> However, the […]

Display posts with tag for custom post type only

I have this is my functions.php file to create tags only for custom post type called ‘image-gallery’: register_taxonomy( ‘image-gallery_tags’, ‘image-gallery’, array( ‘label’ => __( ‘Image Tags’ ), ‘rewrite’ => false, ‘hierarchical’ => false, ‘capabilities’ => array( ‘edit_terms’ => ‘manage_categories’ ) ) ); But I can’t get the list of tags to show in the post […]

data-type=“” … needed post tags stripped of characters

So I am trying to generate a list of post tags on the data-type attribute but I need them to be sanitized so spaces are replaced with underscores and there are no special characters… really struggling with it. <article class=”work_items”> <?php query_posts(array( ‘post_type’ => ‘work’, ‘posts_per_page’ => ‘-1’, ‘orderby’=>’title’,’order’=>’ASC’)); if ( have_posts() ) : while […]

WP Query with multiple tags by get the tags

I need to do a wp query that will get any post that has one tag or more. My current code works for one tag, but I’ve try for multiple with the codex and I can’t do it. Can you help me? <?php global $post; foreach(get_the_tags($post->ID) as $tag) { } $recent_posts = new WP_Query(array( ‘cat’ […]

get_the_excerpt() not returning anything when post has no excerpt

When trying to call get_the_excerpt() the page does not return anything on posts that have no excerpt. I thought WordPress usually ‘fake’ it and create one using the first x characters from the_content(). Or have things changed?

Get posts inside Get terms problem

i have a get_terms which loads correctly. inside of it i have used get_posts. then using get posts i am trying to get each post tags (and count <= not currently inside this script) <?php $categories = get_terms( ‘blogs_cat’, array( ‘type’ => ‘blogs’, ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘hide_empty’ => 0, ‘exclude’ => ‘1’, […]

list tags with count in author profile page

I would like to list tags with count in author profile page just like this page If the user click the tag, then I would like to list the tagged posts. Can someone help me?

Exclude Tags from get_the_tags

While following this article to get tags by date, I was wondering if I could exclude certain tags from what gets returned. The point is to have trending tags but some tags will always be there and I don’t want to include those ones. Here is the code: <?php $how_many_posts = 50; $args = array( […]