Need help on a small wordpress/ WooCommerce code snippet
$30-250 USD
Πληρώθηκε κατά την παράδοση
I created a code snippet to insert random woocommerce products between paragraphs on all blog posts.
Somehow there is a bug that creates 2 issues:
1. When the code snippet is active, youtube videos are not embedded anymore
2. The displayed woocommerce products are kinda messed up, check attached images
Looking for a solution.
sample: [login to view URL]
code:
function addParagraphs($content) {
if (is_single() && !(is_product())){
$the_category = get_the_category()[0];
switch($the_category->name) {
case 'Facebook':
$custom_str = '[product_category category="facebook" per_page="2" columns="2" orderby="rand" order="rand"]';
break;
case 'Threads':
$custom_str = '[product_category category="threads" per_page="2" columns="2" orderby="rand" order="rand"]';
break;
case 'Instagram':
$custom_str = '[product_category category="instagram" per_page="2" columns="2" orderby="rand" order="rand"]';
break;
case 'LinkedIn':
$custom_str = '[product_category category="linkedin" per_page="2" columns="2" orderby="rand" order="rand"]';
break;
case 'Soundcloud':
$custom_str = '[product_category category="soundcloud" per_page="2" columns="2" orderby="rand" order="rand"]';
break;
case 'Spotify':
$custom_str = '[product_category category="spotify" per_page="2" columns="2" orderby="rand" order="rand"]';
break;
case 'TikTok':
$custom_str = '[product_category category="tiktok" per_page="2" columns="2" orderby="rand" order="rand"]';
break;
case 'Twitter':
$custom_str = '[product_category category="twitter" per_page="2" columns="2" orderby="rand" order="rand"]';
break;
case 'Twitch':
$custom_str = '[product_category category="twitch" per_page="2" columns="2" orderby="rand" order="rand"]';
break;
case 'YouTube':
$custom_str = '[product_category category="youtube" per_page="2" columns="2" orderby="rand" order="rand"]';
break;
default:
$custom_str = '[products per_page="2" columns="2" orderby="rand" order="rand"]';
break;
}
// you can add as many as you want:
$additions = array(
"<p>$custom_str</p>",
'<p>[Sassy_Follow_Icons]</p>',
"<p>$custom_str</p>",
"<p>$custom_str</p>",
"<p>[publishpress_authors_box layout='ppma_boxes_476999']</p>",
);
$content = get_the_content();
$output = ''; // define variable to avoid PHP warnings
$parts = explode("</p>", $content);
$count = count($parts); // call count() only once, it's faster
for($i=0; $i<$count; $i++) {
$output .= $parts[$i] ?? '';
$output .= '</p>';
$output .= $additions[$i] ?? '';
// non-existent additions does not concatenate
}
return $output;
}
else {
return $content;
}
}
add_filter('the_content','addParagraphs');
Ταυτότητα Εργασίας: #37564976
Σχετικά με την εργασία
Ανατέθηκε στον:
Hi Max, It appears that your code is interfering with the embedding of YouTube videos and is causing issues with the displayed WooCommerce products. To address this, I'm already thinking of some adjustments to your co Περισσότερα
83 freelancers κάνουν προσφορές κατά μέσο όρο $139 για αυτή τη δουλειά
Hi there, So you want that youtube videos should be embedded and should look clean and formatted. Right? Please initiate chat so that we can discuss and proceed. With regards, Manoj
Hello There, I have seen your site and code carefully. I am confident that I will solve issue in your site. I can start right from today and complete this in 48 hours. Thanks
Hi. I can help you with this and I'm ready to start right now. Please don't hesitate to check my feedback page and see what other clients write about me. Thank you. Cheers. Alex
Hello there! My name is Rajesh, and I'm an experienced professional web developer and designer. I understand that you need help on a code snippet to insert random WooCommerce products between paragraphs on all blog pos Περισσότερα
Good Day, Honorable sir, You can try my service. My name is Zahidul, I have reviewed your job description "Need help on a small wordpress/ WooCommerce code snippet " as well, I found my skills relevant to your project Περισσότερα
Hello Employer, Hope you're doing well. I have read your project description regarding "Code snippet to insert random woocommerce products between paragraphs on all blog posts" & it can be done as I'm an expert having Περισσότερα
Hello, I have done similar solution for a client some time back and know that such issues happens in implement this way. I can look into your site and try to fix it but if HTML structure of blog post is complex then i Περισσότερα
Hi I am an expert Woocommerce developer, will fix the issue with current code snippet so videos are shown and products are not messed up. Let's chat to discuss and finalize. Thanks
HEllo, I can help you to code snippet to insert random Woocommerce products between paragraphs on all blog posts. I have gone all the details and attachment so I am pretty much sure that I can do this .I have some ques Περισσότερα
Need help on a small wordpress/ WooCommerce code snippet My name is Rana, and I'm contacting you from (TopIThuB). Hope you are doing well; we have checked your project description we are best for this project. Kindly Περισσότερα
Hello, I have checked the website and attachments. I am Certified wordpress programmer. I have read the code. It has code issue in the shortcode rendering and the youtube, filter update logic is not implemented. I will Περισσότερα
Dear Client, I am an expert in WordPress and web development technologies. I have carefully reviewed your requirements for fixing the bug in the code snippet you created to insert random WooCommerce products between p Περισσότερα
Hello. I am ready to start work right now. I am very familiar with wordpress, woocommerce website building and theme & plugin development, Child theme development, payment gateway & API integration, custom widget & c Περισσότερα
Hi, Please share login details. I am ready to start work right now. I understand how can it is, and can get this fix for you quickly! I'm a full-stack web developer, designer, and SEO expert, with over 6+ years of expe Περισσότερα
Hello, my name is Adam Levinson and I am a top rated plus freelancer with 15+ years of experience in various technologies such as JavaScript, PHP, WordPress, Linux/Windows system administration and more. I understand y Περισσότερα
Hey there! My name is MD. SAYEED, and I am a freelancer with extensive experience in graphics and web design, specifically WordPress and Shopify development. I understand that you are looking for help on a code snippet Περισσότερα
Hello there! My name is Raushan and I'm an experienced freelancer with 10 years of experience in web design and development. I understand that you are looking for someone to help you solve the issue with your code sni Περισσότερα
Hello Mate, I have a strong background in WordPress development and troubleshooting Woo Commerce-related challenges. The code snippet you've implemented seems to interfere with the proper embedding of YouTube videos w Περισσότερα
Hello, I can fix your Website bug asap. I would love to discuss how I can help you with your project. Please feel free to contact me for more information or for a consultation about how I can help you with your code s Περισσότερα
Hi! My name is Marjan and I'm here to offer you my services as a skilled applicant with over a decade of experience working on Freelancer.com. I believe I am the best fit candidate for this project due to my extensive Περισσότερα