You need to first get and check if there are any tags available, so something like this
<?php if (get_tags()) : ?>
<div class="etichete">
<p><?php the_tags(); ?></p>
</div>
<?php endif; ?>
You can also use !empty(get_tags())
but because if no tags are available it will return an empty array and an empty array is considered falsy, it will not pass the condition and would not display the etichete
div.
So in this case if (!empty(get_tags))
and if (get_tags())
will work the same way.
Related Posts:
- Custom query to get post names beginning with a digit
- Custom Yoast Breadcrumbs URL
- Real time Duplicate title check
- How to check from which page the user is coming to the current page?
- Insert code when users come from an specific referer
- CSS saved & enqueued, but wordpress doesn’t load css text, only file
- Execute only on a certain page
- Add a Custom Class to Admin Menus
- Type hinting and void return question
- login wp impossible
- Replace comment avatars and links at the same time
- How to display recent posts on home page with custom HTML
- PHP 5.5, w3 Total Cache, and opcache [closed]
- How do I add text in a shortcode?
- How to display php source code inside a post using visual editor?
- Stumped – Ajax Response Returns 0
- Upload Image in a WordPress page using PHP
- Get Custom URL For Custom Taxonomy
- How to add custom post meta to default blog post?
- WordPress – how to replace with string on the_content() in single.php
- Shortcode content filter?
- Show full posts in archive
- I want to select the from values from database in WordPress? [closed]
- populate form fields in a loop with ajax
- Error in custom php function doesn’t exist
- Paypal form integration with wordpress registration form without plugin [closed]
- Contact form won’t submit
- How can I hide that I Use WordPress (with W3 Total Cache)
- Can anyone offer any help with this function?
- JQuery calling a Custom PHP function (Works in Dev but not in WordPress)
- Changing the_posts_navigation() html output
- Override a function defined in wp-includes/comment-template.php
- User register hook is not working in woocomerce register form
- Show meta box only for default page template
- What does -> mean in WordPress?
- How to have different header.php based on the user logged in?
- How do I remove a category from a wordpress loop>
- First Byte Time (back-end processing)
- Return product description
- How to add the sidebar to all the pages except the home page? [closed]
- Header not properly displaying on archive.php
- How to update and save user metadata on page visits?
- How to optimize update_post_meta?
- ACF & Bootstrap Gallery Shows Blank Slides [closed]
- Generate CSV file and add data as a new wordpress custom post
- Update if post with specific title exists
- child parent styles enqueue order
- Trying To Get Child Categories To Show, Issue With foreach Loop
- Add URL parameter to all internal links using a specific theme
- Call featured image url
- Use an anchor link to open an iframe inside a WordPress page
- select wordpress custom post type
- In WordPress, how do you make several different editors for a single page?
- How do I reset $wp_query in a function?
- Add class to all img if they have a certain ACF field
- WordPress 6.0 class-wp-widget.php fatal errors in PHP 8.1.6
- Unserialize Custom Field & Save as Multiple Rows in WordPress Database
- Modify WooCommerce used to get all orders in dashboard
- How can I check that the acf field value is not a duplicate when adding a post?
- Add a product category to a specific product via a button
- WordPress can’t use ZipArchive
- Trouble Accessing Gravity Forms API (GFAPI)
- How do I stop an Image Address from loading in the Browser?
- Add class to image in php
- Creating a checklist with ACF and I cannot figure out how to add all iterations to an array that I’m creating
- Trying to generate a CSS file in wordpress uploads folder
- register_setting not save checkbox
- Add a default style if no Featured image is selected
- How does one make a URL return dynamic JSON with custom Content Type?
- custom-header not working
- Need to forward Data from WooCommerce Webhook sent to same site WordPress REST API custom endpoint
- Add Product Permalink in woocommerce admin order page
- Proper use of Output Buffer for a whole php clas
- How do I make comment-reply-button with that takes to comment reply form on click
- Allow user to choose header style
- Require advice handling a URL redirect from a Third Party. URL Params need to populate and then forward to payment
- missing admin bar and widget in a template
- ERR_TOO_MANY_REDIRECTS / To Force SSL Logins and SSL Admin Access
- How to load WP_Editor JS files manually (with AJAX)?
- My own theme’s custom widget areas are not working
- Not able to add new item in wordpress home page
- How to apply filter
- Importing demo data in Multisite
- Allow BBPress participant role to trash topics
- views How to load javascript on custom page template?
- How to find the function which is outputting Array
- Contact form field in wordpress menu
- Manipulate database of WordPress site with my own scripts
- How can I include a file related to blog URL? Nothing seems to work
- How Can I Center the Logo in the Navigation Menu? [closed]
- Where are Sessions are being started? [closed]
- Get the current page in a call back function
- PHP Use Declared array Variable inside already Declared Array
- How to create and add js and css file when server is not on my PC?
- Object of class WP_Post could not be converted to string while trying to console.log wp_get_nav_menu_items
- Check radio get value to array
- Running a php code after User clicks a button? [closed]
- Your PHP installation appears to be missing the MySQL … After deleting and restarting from cpanel
- How to create shortcode of this PHP code
- How to pass javascript var to php var