You can write this code like below-
<?php
$element = get_queried_object_id();
if (!empty($element)) {
$terms = get_terms([
'taxonomy' => $element->taxonomy,
'parent' => $element,
]);
echo '<div style="height: 200px; text-transform: uppercase; border:1px solid #666666; padding:10px; overflow-y: scroll;">
<div class="breaker-small">Refine Search</div>';
foreach ($terms as $term) {
echo '<p class="filters"><a href="' . get_term_link($term) . '">' . $term->name . '</a></p>';
}
echo '</div><br />';
} else {
// Do something
}
?>
Related Posts:
- WordPress function like is_category for subcategory? is_subcategory?
- deregister scripts on certain page
- is_front_page not working in functions.php
- disable comments if array exists
- Problem using is_single() to enqueue script from functions.php
- Conditional tag is_page with a custom post type
- Limit posts only on home page – ideally in functions.php
- Enqueue scripts not working with if is page conditional tag in functions.php
- Conditional read more adjustment
- How add various functions within 1 conditional?
- Conditional Gravity Forms filter in WordPress Multisite
- Has is_archived() for sites in a multisite changed with WP 4.7?
- Testing for a shortcode using a function. 404 page throwing PHP Notice
- is_page() or is_single not working
- functions.php and conditional tags
- issue with if/elseif in_array inside foreach loop display only one post
- Set “woocommerce_is_purchasable” to false for specific “$product->is_stock_status”
- Entirely Different Functions.php per Page?
- Function to echo (or display?) wordpress tags in the head section
- is_home() not working in functions.php file
- If is_single in functions.php
- Enqueue script if not page template
- is_product_category(‘Services’) not working
- method to fetch entire tag list on archive.php
- how to display featured image for single post for a specific category
- Load CSS conditional on custom field is present
- admin-ajax.php nulls all php variables
- restrict access to specific urls on a specific period of time
- Change conditional tag in wordpress without editing the core files
- wp_enqueue_scripts called twice?
- How can i hide content if not friend in Buddypress? [closed]
- PHP Notice: Function is_page was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false
- Missing feature image link function
- How to customize the_archive_title()?
- Get menu object from theme_location
- Displaying the number of updates available in the Admin area
- Trying to use add_action and do_action with parameters
- Safe to disable wptexturize?
- Get a list of all available fields in the User Profile
- How do I use the WP image functions in a page template?
- why doesnt is_home() work in functions.php
- Insert Ad Code in the Middle of a Post
- Add options to featured image
- WordPress Change Post Templates,but not drop down, but Image selection
- Programmatically Add Font-Awesome Icons to Category Widget
- Remove images from get_the_excerpt
- Remove “says” from comments
- Reuse variable in hook callback
- Dynamically Register Sidebars For Each Top Level Page
- Run Product Filter Javascript On Page Template
- Can you use admin pages functionality on the frontend of your site
- How to add a column to the Trash page?
- Overwrite Parent Theme add_image_size in Child Theme
- Custom registration URL lost when user makes signup mistake
- Images uploaded using media uploader are appearing upside down
- Individually styling date month year [closed]
- Tiny MCE-modifications (plugins) stopped working in WordPress 5.6
- Writing functions in WordPress functions.php that don’t replace a WordPress core function
- How to hook into a function offered by a plugin?
- HTTP_HOST changing in functions.php
- Change position of media in admin menu
- How can I remove the main description text box in a Woocommerce product editor page? I only use the “Product short description” text box [closed]
- show first 3 thumbnails of posts in different sizes [closed]
- Getting custom image size URL in functions
- new_excerpt_more link not working properly
- Where to add the permalink in this function?
- WordPress function saves a post twice and updates all posts
- Change CSS for logged in users
- if statement for wordpress default featured image on single post
- Function to display post by specific author
- Return category name with & Ampersand doesnt work
- Control the srcset much more (not all sizes in it each time)
- Warning: join(): Invalid arguments passed in post-template.php
- javascript and css links not working on sever
- What are the meta fields for an attachment?
- Adding product to WooCommerce cart [closed]
- Add loggedout class on body using a function or JS
- Insert a field with PREG_REPLACE – strange behaviour
- Difference between get_userdata() and get_currentuserinfo()
- Astra theme – cannot set short product description under the product title (product name)
- Is posible to redirect a few URL?
- Run function with schedule is not working correctly
- Combine page types and Custom Taxonomy in a functions.php command
- I have defined 2 text strings, how do I use them in my posts?
- Create New User Custom Field not Saving
- Keep Admin Logged In For a Year
- WordPress Ajaxifying not working properly
- Strange result of get_stylesheet_directory()
- Comment function for page
- Using a variable in name of dynamically-called helper function
- How to add function to custom fields when page/post has a password?
- Call custom field using php
- How to Update User Meta Field other than from profile?
- Retrieve array of attachment IDs attached to a given Post ID
- add_theme_support not outputting thumbnails
- More link – not text
- update_user_option not working as expected
- How do I access variables outside a function [closed]
- Add functionality to block comment authors in the Comment edit pag
- WordPress enque the same script causes the setInterval not to work