get_the_tags function not retrieve all tags for specific category
get_the_tags function not retrieve all tags for specific category
get_the_tags function not retrieve all tags for specific category
the_tags() doesn’t return the links but immediately echoes them. As that happens before the echo they appear before the span. What you want is this: echo ‘<span class=”tags”>’; the_tags(‘See also: ‘, ‘ · ‘); echo ‘</span>’; or even simpler the_tags( ‘<span class=”tags”> See also: ‘,’ · ‘, ‘</span>’ ); As a general rule of thumb … Read more
wp_get_attachment_image_url is not returning the good image size. The function need the name of the image size or a valid image size (1200 x 9999 is not a valid size, just the the way to tell add_image_size cropping definition). Then the scrapper will be able to scrappe your content. If think there is a minimum … Read more
you can use the get_the_tags function, something along the lines of: $posttags = get_the_tags(); if ($posttags) { echo (count($posttags) > 1) ? ‘Tags: ‘ : ‘Tag: ‘; $links = array(); foreach($posttags as $tag) { $links[] = sprintf(‘<a href=”https://wordpress.stackexchange.com/questions/255261/%s”>%s</a>’, get_tag_link($tag->term_id), $tag->name); } echo implode(‘, ‘, $links); } Reference: https://codex.wordpress.org/Function_Reference/get_the_tags
this is an example output of an tag cloud widget element (wp4.8): <a href=”http://localhost/wp-beta-test/tag/handcrafted/” class=”tag-cloud-link tag-link-327 tag-link-position-22″ style=”font-size: 8pt;” aria-label=”handcrafted (2 items)”>handcrafted<span class=”tag-link-count”> (2)</span></a> as you can see, the widget outputs some aria lable also using parentheses, which interferes with a simple string replace. the tag number including the parentheses is also already wrapped in … Read more
Thanks for your answer. I figured it out, i was using the wrong function. <?php $tags = get_the_tag_list($before=”<li>”, $sep = ‘</li><li>’ $after=”</li>”); if( count( $tags) > 0) { echo ‘<div id=”etiquetas”>’; echo ‘<ul class”tags”>’; echo $tags; echo ‘</ul>’; echo ‘</div>’; } ?>
I will probably do something like this to make it dynamic but this have some issue with the title that must be “Season $n” in the title. Probably better solution will be to add some custom field with the season or some custom taxonomy just to filter. if ( $my_query->have_posts() ){ $seasons = array(); foreach($my_query->posts … Read more
I suggest evaluating the premium plugin FacetWP (I am not affiliated with them), that supports faceted navigation and filters for WooCommerce too. https://facetwp.com/using-facetwp-with-woocommerce/ Or any other similar plugin of course, I know only FacetWP myself. As for the second question, I think that such plugins manage the display of specific filters automatically, excluding non-pertinent ones.
You need to get the tag ID first. You can get the tag ID from the slug using the get_term_by() function: $tag = get_term_by( ‘slug’, ‘tag-slug-here’, ‘post_tag’ ); echo tag_description( $tag->term_id );
To list names and descriptions you can use get_terms(). That will return an array with all terms. An example would be: global $post; $terms = get_terms( array( ‘taxonomy’ => ‘item_tags’, ‘hide_empty’ => false, ) ); if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){ foreach ( $terms as $term ) { echo … Read more