First you have to find the category ID, which can be done easily with the function get_the_category()
.
To get the slug, use: $catID = get_the_category(); $catSlug = $catID->slug
.
To get the link: $catLink = get_category_link($catID)
.
Related Posts:
- How to add category to: ‘wp-admin/post-new.php’?
- Display all posts from specific categories on a page
- How to show list of posts by author and category?
- Divide Loop Into Days & Categories
- How to filter posts that belong to a specific category only if that is the only category
- Converting a dynamic piece of code using WordPress Loop into a static one using Post ID
- Display post category in foreach loop with category link
- Child_of not displaying all children posts.. via get_posts
- Exclude category from
- Pulling in post category and children within category
- Listing Specific Categories from Current Post with Depth
- How to make the first post in the loop be styled like a “new / featured” post?
- How do I stop the loop from repeating in my category template?
- get_the_category listing in hierarchial order
- why does wordpress ignore the post args?
- Change all author links in Blog roll
- Showing categories and subcategories with posts
- if in category but only with post meta
- Display post number by category
- The loop starting at a certain ID
- WP_Query of Category Not Showing First Post
- posts going to 2 pages/categories only show up in 1
- Get current taxonomy and display query accordingly
- Only the most recent post is showing on my category page (working on localhost, not live site)
- Post meta not working
- Current post categories and subcatecories outside of the loop
- How to distinguish pages created by woocommerce?
- Re-order Category Meta-data
- How to show category image if no featured image is set?
- Display new posts categories in separated divs
- List Authors For Current Category
- Multiple Post Repeat for Related Post Loop by Category
- Where should get_post_meta() go to get $post->ID get_post_meta() is empty and $post->ID & get_the_id() are working
- Show post if in category
- Displaying categories items among posts
- Make assigning post to a specific category equivalent to assigning it to all categories
- Show all posts in category
- View post with specific category id and name which I selected in the backend (drop-down option)
- Site ‘Categories’: save an admin global setting with post metadata [closed]
- WP_Query: Mixing category__in and tag__in together
- Start WP Pagination From Number 1 in URL
- If in_category not working for multiple single.php pages
- Calling Different Custom Post Timestamps in a table
- How can I setup a relationship using categories in WordPress?
- WordPress Multisite – Create Default Post and New Category On New Site Install
- how to show single post in a custom template
- Using ajax on editing a category edit page?
- Is it possible to paste a link without tags and make it directly a link in a post?
- Related posts by category not working right
- How to list recent posts in a wp nav menu?
- Set Default Category to Username
- Disable sticky option for specific categories
- Dynamic dependent Dropdown lists for categories, sub-categories and posts
- How to add tags (custom taxonomy) to post class css?
- How can I hide tags on a child-category page, if that tag has not been used?
- date issue with category post retrival
- Cannot retrieve a custom RSS field from posts
- List authors with the last post title and order by last post date
- How to exclude visited posts from loop
- How to make multiple sections in home pulling posts category wise?
- Use two different post_per_page limits with infinite scroll
- How to display two blog categories as separate sections on one page?
- Saving custom fields to a custom taxonomy
- wp_query random post
- How to Mysql select a list of posts with meta_values AND all relevant categories?
- “Right Way” to make custom Loop respect reading settings inside admin panel?
- How to setup a query to output posts by groups of five?
- Only display sticky post or latest post in custom loop
- Display post category in foreach loop
- Single.php – Get Current Parent Category
- How to order posts in an arbitrary order?
- How to automate featured posts number? [duplicate]
- Is it possible to add/tick a category to a post when it is created?
- Excluding posts not working
- How many posts does the loop return?
- Display Posts on Custom Page
- How to make a sum of all posts displayed in a loop
- Possible to alternate between two loops
- Exclude current custom post on single post
- Hide posts belongs to few categories in homepage
- Wrong post title displayed from loop
- Get Value of Post before
- post category in wp_insert_post
- Multiple Loops Breaking Pages
- add to end of post in the loop with plugin
- Limit the number of posts a category can have – newest post goes in, oldest one drops out, possible? plugin?
- Recent posts per category loop?
- First x post with another template then the others
- How to get subcategories from category slug?
- Remove current category from post but display all others
- Loop doesn’t show title of second post and posts thereafter
- How show categories in admin and get that selected to show posts in index
- Customize rel=canonical tag for single blog post
- How to I retrieve the ID from the Posts page?
- How to save meta checkbox WordPress
- Grid post page on WordPress with Bootstrap, the_excerpt(); Problem
- Second get_permalink inside loop points to wrong URL
- Change default category when I publish a post
- Get the amount of posts on a current page
- Loop parent terms {display posts} AND loop child terms {display posts}