You could use a simple conditional and check if the post has a term using has_term()
:
has_term( $term, $taxonomy, $post );
Pass in your Term Slug, the taxonomy ( which sounds like you’re using post_tag
and the post object, no javascript needed.
<?php if( has_term( 'term_slug', 'post_tag', $post ) : ?>
<div>
Show your div here!
</div>
<?php endif; ?>
Related Posts:
- is_page not working when loading javascript with add_action in functions.php
- is_front_page() variable not found
- How to delete a cookie?
- ES6 Map in Typescript
- Sort array of objects by string property value
- Chrome sendrequest error: TypeError: Converting circular structure to JSON
- How to set header and options in axios?
- How to deal with floating point number precision in JavaScript?
- What’s a maximum call stack size exceeded error and how to fix it?
- NPM ELIFECYCLE error – using node server.js command
- Is there a link to the “latest” jQuery library on Google APIs?
- How do I correctly clone a JavaScript object?
- JavaScript: Upload file
- Console logging for react?
- What is the “right” JSON date format?
- How to clear the canvas for redrawing
- No value accessor for form control
- React eslint error missing in props validation
- How to specify multiple conditions in an if statement in javascript
- Mongoose – What does the exec function do?
- Developing an ad with MRAID.js
- ReferenceError: Invalid left-hand side in assignment
- How to detect Safari, Chrome, IE, Firefox and Opera browser?
- Javascript versioning to avoid caching, difference in these practices?
- illegal use of break statement; javascript
- Open URL in same window and in same tab
- ReferenceError: document is not defined (in plain JavaScript)
- JavaScript innerHTML not updating element
- Palindrome check in Javascript
- Console is throwing Unterminated JSX contents error
- Console.log not working at all
- Blocked script execution in because the document’s frame is sandboxed – Angular application
- Node update a specific package
- How to fix RichEmbed Discord.js
- How to convert selected HTML to Json?
- How to move an element after another element using JS or jquery?
- Converting any string into camel case
- Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of Transition which is inside StrictMode
- How to use Javascript to read local text file and read line by line?
- Why is the jquery script not working?
- JQuery Datatables : Cannot read property ‘aDataSort’ of undefined
- includes() not working in all browsers
- Why does JSHint throw a warning if I am using const?
- Uncaught TypeError: .indexOf is not a function
- Get all non-unique values (i.e.: duplicate/more than one occurrence) in an array
- Javascript onload not working
- How to parse float with two decimal places in javascript?
- Checking for duplicate strings in JavaScript array
- How to get current date in jQuery?
- Print the contents of a DIV
- Remove all special characters except space from a string using JavaScript
- How to Scroll Down – JQuery
- What does the .subscribe() function do?
- is there something like isset of php in javascript/jQuery?
- jQuery – Dynamically Create Button and Attach Event Handler
- Highlight a word with jQuery
- Javascript: ‘window’ is not defined
- How to reload page every 5 seconds?
- How do I handle newlines in JSON?
- Update style of a component onScroll in React.js
- Fire oninput event with jQuery
- javascript includes() case insensitive
- Reading local text file into a JavaScript array
- “NS_ERROR_DOM_BAD_URI: Access to restricted URI denied”
- Reset Undo on the tinymce editor
- Combine enqueue js without affecting dependencies
- Detecting WordPress Customizer Panel
- Customizer – instantiating settings and controls via javascript
- How do I enqueue(or delay loading of) tags in individual page posts?
- JavaScript in page doesn’t open new window [closed]
- wp_enqueue_script adds only the first script
- Add javascript to a woocommerce page template
- Dynamically insert values in a WordPress SelectControl Options field
- Vimeo froogaloop
- can a buttongroup have a label?
- Preloader for a WordPress Site
- Trying to integrate Zoho Campaign Form [closed]
- InnerBlocks restricting does not work on nested blocks
- How to open the add media dialogue it in a certain state / tab?
- Implementing Webflow JS in WordPress
- This page can’t load Google Maps correctly [closed]
- Load images after page load
- Gutenberg RangeControl
- How to stop javascript code being broken when going into visual editor
- WordPress opens js files as a catalog. Path is right [closed]
- Javascript to open new window
- Facebook fanbox problem
- Add Paypal button redirect to a specific page after completing
- Javascript File Does Not Work
- wp-api Backbone JS Client fetch options
- Get the ID of a page in Parent combobox in editor
- Google Page Speed
- Can’t Listen to KeyDown in TInyMCE Iframe (jQuery) and Pass it to Parent HTML FORM
- Is it feasible to call angular’s page from wordpress website?
- Trying to deque some .js from source
- How to Create a Repeatable Meta Box
- Styling parent based on a child element of a child in a WordPress page
- Why isn’t my SVG path rotating on scroll on iPhones?
- Working with a non-React external library in a custom block
- Using a form to pass GET parameters and create an array of posts accordingly