What you are looking for is get_the_category()
. Retrieve a list of the categories, and then run a loop and only output their names:
$categories = get_the_category();
if ( ! empty( $categories ) ) {
foreach( $categories as $category ){
echo esc_html( $category->name );
}
}
This function returns an array of WP_Term
objects. You can check the provided link for a list of available methods.
Related Posts:
- How to override JavaScript files in child theme?
- Versioning @import of parent theme’s style.css
- How to add code to Header.php in a child theme?
- Why does my child theme CSS get called twice?
- How do themes provide support for child themes?
- Attributing a version number to a child theme’s main stylesheet
- Preserving theme settings in child theme
- Is it possible to make grandchild themes?
- how do I queue my Child stylesheet/s *after* every Parent stylesheet/statement?
- How to cache bust a child theme style.css
- Is a text-domain necessary for a child theme
- How to modify single.php in a child theme?
- Cannot get Child Theme to load latest version of style.css
- Issues enqueueing parent & child theme stylesheets with revised Codex method
- @package & @subpackage: how to use with child themes
- How to override function in child theme
- Why is the Child Theme Stylesheet Not Loading?
- Hiding Parent Theme
- get_stylesheet_directory() vs get_template_directory() for child theme
- Theme Customization API and child themes
- get_parent_theme_file_path vs. get_template_directory
- Git vs Child Theme
- Give priority to child theme stylesheet
- Child theme does not overwrite parent themes style.css
- how to call files in child theme?
- Get Parent Theme Author Name
- Get parent theme version
- Optimal approach for replacing the 8 header images in a child theme?
- How to transfer changes to a child theme?
- WordPress master + child themes + Git workflow
- How to use parent theme’s enqueue methods
- How do I override a parent theme’s language files with a child theme?
- something like is_childtheme()
- Do all files in child theme override the parent?
- Child theme showing a blank page
- Child theme preview missing
- Child Theme Performance
- How could child theme be different than parent theme if I haven’t made changes?
- How to solve “Warning: Use of undefined constant” when overriding a parent theme function in the child theme?
- Do I need to update the child theme too after updating the parent?
- get_template_directory vs get_stylesheet_directory
- Theme customizer: How do you grab the value later?
- Developing a childtheme, how to disable the parents templates?
- Under heavy cache conditions, updating the parent theme don’t reflect changes with child theme enabled
- How to maintain wp_enqueue_style dependencies set in parent theme style enqueuing
- Child Theme, Functions.php Issues
- Redefining function in child themes
- How do I check for child theme files first using include, before going to parent theme?
- How can you change default color scheme in a Twenty Fifteen child theme?
- Use admin options from parent theme in child theme
- When activating a child theme, what core settings have to be reset ie; Custom Menus etc?
- Hwo to turn off “get_parent_theme_file_path” in child-theme?
- Overriding parent theme file
- How to “remove” file from parent theme
- How to override the Parent theme Function into child themes functions.php
- How can I make new .css file in child theme override styles in child theme’s style.css
- Enqueue styles properly in a child theme and stylesheets location
- Enqueue more than two CSS styles in a child theme functions.php
- Proper way to make a tweaked theme into child-theme setting?
- Promoting child theme to stand alone
- How to disable updates in WordPress theme
- Style.css in child theme is loaded before Bootstrap
- Activating child theme returns “active theme is broken”
- Overiding functions.php with child-theme
- How are updates to the style.css file in child theme recognized?
- How do I set up a child-theme without using @import
- Find a Parent Theme’s stylesheet $handle when it registers a stylesheet
- Child theme error “Template is missing”
- Dequeue only stylesheets but not inline style added using wp_add_inline_style
- Prevent child theme from inheriting a parent theme’s required file
- Run two concurrent themes in one installation
- Child theme only loads on home page
- wordpress every page returning 500 error
- creating a new child theme
- How to activate the child theme in WordPress?
- Test if a Category contains certain Custom Post Types
- About wordpress child themes
- How to add modified php in child theme?
- Body classes in child theme
- Selling a child-theme of twenty-thirteen is legal? [closed]
- What is __(arguments) in my functions.php
- Edit copyright in Hesita Child Theme
- How to override a theme template file with a child theme template file (of the same name)
- Vague Errors from VIP Scanner Plugin
- WordPress | enqueue_scripts in a child’s theme returns error
- melville and its child theme
- How to create my own style.css file in an wordpress child-theme
- Can anyone help me with replace genesis post excerpt with yoast meta description and if there is no meta description show the excerpt?
- How to handle a large child theme
- Child theme customizer preview doesn’t work/load
- theme.json should be in the child theme folder when using xxxx.json style located in the styles folder?
- Child theme css not loading when declared in parent functions
- Modifying posts based on category in TwentyTwentyTwo theme
- Is it possible to load a child theme from a remote server?
- For a Child Theme, do I duplicate the parent style.css and then add my child css?
- Twenty Twenty One update changes dom classes and breaks my child theme
- Child Theme Reverts to Parent Theme After Activation: Customizations Lost
- Site with child theme breaks parent theme even after activating just parent theme
- How can I add ReactJS to the child theme?
- Can’t disable child theme style