Forum Replies Created
-
AuthorPosts
-
FYI – We ran a test on a small site we use in-house and the code worked perfectly without conflict (good advise from you about testing)
Here is the full post with details for any other enfold users:
2. Display New Products Programmatically
Let’s say you want the products to be displayed in multiple places on your website. Then, it can be very tedious to open all the required sections of your website and add the block or the shortcode to them. Instead, you can just add a code to your theme files to display a “New” badge on the new products of your WooCommerce store.
But before moving forward, please make sure to backup your website and create a child theme using one of the child theme plugins. This will ensure that all the changes that you make to the core theme files are not affected when you update the WordPress theme.
2.1. Open the Theme Function FileWe will add the code snippet to the functions.php file of your theme. So, go to Theme > Theme File Editor from your WordPress dashboard after activating the child theme.
Then, you will need to open the functions.php file from the theme files on the right side of your screen.
theme file editor display new products in woocommerce
2.2. Add the Code to the Theme FilesAfter you open the theme functions file, scroll down to the bottom of the file and paste the following code snippet here.
add_action( ‘woocommerce_before_shop_loop_item_title’, ‘quadlayers_new_product_badge’, 3 );
function quadlayers_new_product_badge() {
global $product;
$newness_days = 10;
$created = strtotime( $product->get_date_created() );
if ( ( time() – ( 60 * 60 * 24 * $newness_days ) ) < $created ) {
echo ‘<span class=”itsnew onsale”>’ . esc_html__( ‘New!’, ‘woocommerce’ ) . ‘</span>’;
}
}The above code will add the new badge to the products that have been added to your website in the last 10 days. You can adjust the number of days according to the needs of your website. They can be changed depending on the number of days that you consider your recently added products to be new.
After adding the code, click on Update File.
You will be able to see that the new badge is added to the new products of your WooCommerce store when you preview them. The quickest way to view them is from the shop page itself.
Still having issues on the Video loading without glitches, but go ahead and mark this support ticket as Closed. We will work on the Glitches later.
Thanks
NEVER MIND… COPY PASTE ADDED CHARACTERS TO YOUR CODE, SO WE CHANGED IT AND IT WORKS FINE.
Thanks for the support!!!!
This reply has been marked as private.Please close this ticket…
AveryThanks Rikard, it worked like a charm. Your support has always been terrific and very timely.
Thanks Again,
AveryThis reply has been marked as private.See the below information requested in the private section
Mike, we have added the above additional CSS on both our test site and the actual site and neither one worked to fix the issue.
Paul
January 18, 2021 at 5:10 pm in reply to: Updating failed. The response is not a valid JSON response. #1273379Good Morning Rikard,
I just wanted to provide you with an update on this support ticket.
We finally updated the site to the latest WP version and all its current plugins, and everything is working correctly… knock on wood!!!!
I have no idea what caused this, but whatever it was, it is gone!
Thanks for your excellent and very professional support. We have been using your theme enfold for years, and we do so for multiple reasons, but the main one is your support is a 10 out of 10 / 5 Star…
I wish you and the Enfold Team an Awesome New Year. May 2021 bring you all Health & Happiness!!!Paul – So Evolve Team
December 23, 2020 at 4:21 am in reply to: Updating failed. The response is not a valid JSON response. #1269430This reply has been marked as private.December 21, 2020 at 6:46 pm in reply to: Updating failed. The response is not a valid JSON response. #1269109This reply has been marked as private.December 19, 2020 at 12:26 am in reply to: Updating failed. The response is not a valid JSON response. #1268523Rikard,
FYI – we decided to roll back the site to a clean and known time when the site did not have these issues. WordPress 5.6 is now the latest version and we are not updating this site until we can determine what has caused the many problems.The site is working fine now, but obviously there is something that caused these problems, so if you have any further ideas please let us know.
Also, I will re-add you to the Users list
Thanks
PaulDecember 18, 2020 at 1:50 am in reply to: Updating failed. The response is not a valid JSON response. #1268281This reply has been marked as private.December 17, 2020 at 5:13 pm in reply to: Updating failed. The response is not a valid JSON response. #1268160See below:
December 16, 2020 at 6:38 am in reply to: Updating failed. The response is not a valid JSON response. #1267697This reply has been marked as private.December 15, 2020 at 1:13 am in reply to: Updating failed. The response is not a valid JSON response. #1267287This reply has been marked as private.December 12, 2020 at 5:39 pm in reply to: Updating failed. The response is not a valid JSON response. #1266786This reply has been marked as private.December 11, 2020 at 4:27 pm in reply to: Updating failed. The response is not a valid JSON response. #1266584This reply has been marked as private.December 10, 2020 at 5:42 am in reply to: Updating failed. The response is not a valid JSON response. #1266173You have my permission to enable the debug mode.
Thanks
Paul
December 8, 2020 at 2:41 am in reply to: Avia Layout Builder – Featured Image in Blog Post does not display #1265654This reply has been marked as private.Thanks,
We made this adjustments and all works perfectly.Paul
See requested info in private content area.
Paul
Thanks
This reply has been marked as private.Nikko,
Thanks for your great support.Paul
Here is the link to the error log… see pvt content area
This reply has been marked as private.We are setting up the debug on the cPanels for both sites:
StephanieRiseley.com
SunSpiritGems.comThe problems came due to updates:
updating from Woocommerce 3.9.3 to current version 4.1.0
WooCommerce PayPal Powered by Braintree Gateway 2.3.10
Any additional info you have or if you hear of others experiencing these issues we would appreciate any updates.
cheers
April 4, 2019 at 7:06 pm in reply to: Blog – not displaying published post dates (all the same – have screenshot) #1087170Hey Rikard,
We changed the; Define Blog Grid layout – Do you want to display a read more link?
and everything is working correctly…
Thanks for the assistance
Avery
-
AuthorPosts