You mixed JavaScript code with css.
Going by the code you provided you would need to do this.
<?php if (!is_user_logged_in()) : ?>
<style>
.product-purchase-box{
display: none;
}
</style>
<script>
($ => {
$(".single-product-widget").text("Please Login/Register To Download");
})(jQuery);
</script>
<?php endif; ?>
Related Posts:
- Converting HTML Template to WordPress Theme
- Customize position of social icons in upme plugin [closed]
- How to get the value of input hidden html from text editor to custom page template?
- How do I add a custom css to all posts without affecting homepage css? [closed]
- Add data-id attribute to child page links
- Multisite – Display different header content based on which site is accessed
- Save Option on Database
- HTML in PHP problem [closed]
- Add multiple HTML attributes to an Elementor button
- Missing sidebar parameter “fix” – before_content
- How Display Posts on category
- Hide wordpress field if data is empty in post!
- How to get the POST TITLE using the POST ID?
- Change the site tagline (or similar) based on current page
- Trouble creating conditional PHP for nav menu items with children for custom Walker
- HTML tags in bloginfo description
- Setting custom canonical urls
- Only show search results with if current date is between two dates?
- database interactions using OOP
- Customizer: Output default value in Customizer CSS
- ACF page while loop breaks footer while loop
- How to add just one specific page to widget without plugin?
- Remove one value in dismissed_wp_pointers?
- create a select input with menus created on a custom options page
- Taxonomy linked to pages
- Getting a specific post values to another div or modal
- Add a class to the anchor tag on HTML5 gallery
- Transferring working local PHP site to wordpress – with database (MySQL)
- Create another “Display Site Title and Tagline” checkbox, “Header Text Color” setting and control
- how to remove metadata from the posts of my blog?
- Load a page into a div with Ajax
- Accessing data from a non-WP database/table within a page content
- My form action url is being prepended with a directory that does not exists
- WordPress blog post url on category page
- Where in PHP do I move title and meta (date) to bottom of each blog section?
- Changing layout with wp_customise
- WP dynamic featured image – Can’t get second featured image url
- Extending the WP_Widget_Text class
- Multiple options not staying selected after saving
- Using the echo command adds unwanted br tags to source
- custom fields wordpress
- Selectbox in admin panel function linking to CSS
- Why the JavaScript code is ignored from wp editor?
- Can I install/embed WordPress on a ‘single page’?
- Populate dropdown with Child Pages based on Parent Page chosen
- How to store data from multiple forms using ajax and php
- search and replace preword from author
- Embed html in php code
- How to check if a meta value has already been assigned to any user?
- How to hide products that do not have an image from a slider carousel for an ecommerce webpage?
- Customize Theme comment template to Insert VoteUp and VoteDown buttons
- filter default query to show just selected level of child pages in wordpress
- WP grandchild categories in nested ul li
- Retrieve $_POST data submitted from external URL in WordPress(NOT API)
- Use DOMDocument with ob_start breaks my HTML code
- Trying to build simple deposit code that hooks into woocommerce
- How to pick the default selected value in wordpress dropdown?
- How to change redirection route to a php page for making it only accessible by logged-in members?
- Add New User, extra fields which are required?
- user_profile_update_errors hook not executing
- Send an email to specific adress when button is clicked?
- Customizer: active_callback and sanitize_callback incompatibility?
- Saving and Restoring a Canvas on A Individual User Basis
- Redirect specific user role to specific site after login?
- Send multiple attachments with wp_mail in PHP
- WordPress admin pointers tour bug?
- selected option if current category is the value
- custom url rewrite for wordpress
- Extend plugin Class through functions.php
- How to add a do_action on refreshing of WP customizer?
- How to remove ?wp-mce-4103-20162941
- Weird 404 URL Problem – domain name being placed at end of urls
- Why Won’t My Inputs in a form with a Get method work together?
- parts of url disappear when using # inside href=”” [closed]
- Settings API callback function inserts html quotes from nowhere
- Input data from email form not going to JSON file
- Make a list of sites for each user in WPMU – switch_to_blog (display in SITE_ID: 1)
- Menu jumping when calling it via PHP
- Different post styles depending on category
- How create a Shortcode with hover and complex options
- How do I remove the product thumbnail link from a specific div in Woocommerce? [closed]
- Output Video Download Link in template
- Modify custom field input data before creating a new post
- Dot is not added at the end of href
- WordPress Multiple Navigation bars
- Position banner to right of logo in header – messed up my header file
- Commenting out unwated CSS/scripts in HTML with PHP
- Output custom field value to post string
- Compare the old get_theme_mod($name) to the new get_theme_mod($name) return value
- Using $wpdb (WPDB class) ‘replace’ with multiple WHERE criteria problem
- Media Upload , file name changed automatically
- Replace shortcode in substring
- Custom posts in different columns style
- How to separate HTML and WordPress files
- Add .htm extention to a custom taxonomy
- Login to wordpress by clicking a link and specifying usernaname and password in url
- Need help enqueueing webfonts
- Auto 301 to full post permalink? (using : /archive/%post_id% to %post_name% )
- need help with existing code showing subpages
- how to show only specific category for a template