In your tag code you are missing a few quotes chars, the $tag
var, and you cant endforeach
like that i add braces for it:
<div class="tag-cloud" style="margin: 20px 0;">
<?php
echo '<select class="tags">';
// Add custom option as default
echo '<option>' . __('Select Tag', 'text-domain') . '</option>';
// Get categories as array
$tags = get_tags(array('orderby' => 'count', 'order' => 'DESC'));
foreach ((array) $tags as $tag){
// Check if current term ID is equal to term ID stored in database
$selected = ($tag == $tag->term_id ) ? 'selected' : '';
echo '<option value="<a href="' . get_tag_link ($tag->term_id) . '" rel = "tag">' . $tag->name . '(' . $tag->count . ')'.'</option>';
}
echo '</select>';
?>
</div>
Related Posts:
- 404 Error On Category and Tags Pages
- Sort posts by tags in category pages
- Root level category, tag, author and archive pages to work
- How to filter archives both by category and tag?
- Remove Archive Headline and Archive Intro Text fields on category and tag archive pages in WordPress Admin with Genesis framework
- Help with multiple dropdown tags search
- wp_dropdown_categories() scripts working erratically on sidebar
- How to Remove a Title from All Category and Tags Page?
- Search tag within category
- Is There a Difference Between Taxonomies and Categories?
- What is the difference between a “tag” and a “category”?
- How to get category and archive title?
- Get rid of WordPress category, tag and author archives?
- Can’t custom taxonomies have same terms (slugs) as categories?
- How to display non-hierarchical taxonomy as terms with checkboxes?
- Category archive by year with permalink support /category/YYYY
- get_categories for custom post type with a specific custom taxonomy attached
- How To Modify The Loop in archives.php To Have 11 Posts Per Page and CSS Styling
- How do the ‘tag’ and ‘category’ (default) taxonomies do ‘save_post’ action?
- Control term order on a per-post basis
- get all tags from category
- Force WordPress to Show Pages Instead of Category
- Checklist of selected categories
- Decreasing the Memory Consumption of a WordPress Site?
- What’s the URL for a category archive?
- Rewrite URL with category and tag combined using WP_Rewrite
- How to tax query X number of posts related by tag first, then by category if not enough in tag-related
- Use tag interface for hierarchical taxonomy?
- How to search for categories and/or tags?
- Using URL parameters, list posts from category and custom taxonomy
- Dropdown with category selection
- How to get the url to tag & category base set by the user?
- How to get the category of the post and link it to the archive (of the category)
- Filter categories using tags
- Sticky posts on home page, search, tag and archives without plugin
- How to hide a specific category posts in my monthly archive?
- Optimal way to redirect home page to category archive?
- Display posts links from a category group by year
- Are Categories, Tags and Custom Taxonomies any different in regards to SEO?
- Category and tag with same name
- Display list of Sub-Categories and the posts they contain, within one main Category
- Create subdomains for tags and categories
- In the tag archive – display count of posts for each category they belong to
- Is it possible to disable certain user roles from creating tags?
- Automated adding of one tag to all the posts in a category
- Saving two categories from two dropdowns in front end posting form
- Get id of category from drop down menu
- Moving Categories submenu to Media, but still opens Posts menu
- Sort category page with custom field
- How to create tabled index of posts in a certain category
- How would you create a “weekly” archive?
- Exclude most recent posts from specific category in wp_query()
- Sticky Posts Not Sticking to Top of Category Archive
- When using get_categories or similar, is it possible to filter results that contain certain Tags as well?
- How to totally get rid of Category in my blog?
- How to add HTML5 ‘required’ attribute to wp_dropdown_categories() without JavaScripts?
- Showing all the posts in one page?
- Categories and Tags returning 404 on the sidebar when using ugly permalinks
- Category Specific Archive
- How to have Multiple Archives Widgets, one archive widget per category (in a different page)?
- Deleting All tags except categories Wp database
- Is it possible to put tags and category information in the post as text?
- Are Custom Taxonomy Templates Possible?
- “Sticky” posts for each category (archive.php)
- Script to duplicate categories as tags
- Search by word, category, tag, author
- I want exclude the particular category in sidebar
- Remove Categories and Tags from Admin Dashboard
- display most popular tags of category?
- Display only posts from referred category on date archive page
- Get tags specific category
- Using widget logic I want to show only a widget on the archive page if there are no posts
- What type of page should i use? static page or category page? and what’s the difference? [closed]
- Can paginate_links() be customized for a specific category or tag?
- How to retain the values from dropdown category lists after wrong form submission?
- Any way to assign Post Categories and Tags to Links?
- Creating archive pages for children categories
- Category archive page – loop through posts of certain tag (with pagination) – pre_get_posts
- Category vs Tag vs Table
- Display “add to cart” button on every listing in product category page?
- Custom WP_Query for current category (in category.php)?
- Hide tag and category boxes from the post editor
- Retrieve all posts within tag OR category?
- How to find the number of Tags a post has?
- How to not treat categories as tags in feeds
- WordPress categories being called “archives” in google links. How to remove?
- How to use wp_category_checklist()?
- Categories: A Greenhorn Question on Strategy (Not Code)
- How to customize tag and category post listings to show introductory content?
- wp_dropdown_categories and custom taxonomy + custom post type
- conditional for sub category on archive page
- Sorting posts by season
- How to provide value for ‘selected’ on wp_dropdown_categories() for ‘multiple’ options
- weekly archive for custom category
- WP_Query() returns null when results exist!
- Are Category or Tag Archive Pages Possible?
- Warning: sizeof (): Parameter must be an array or an object that implements Countable, On products pages
- WordPress subcategories return 404 in custom template
- How can I duplicate categories and tags?
- How to run select query of post with category and tags for API?