How to create different woocommerce single_product.php pages for each product? [closed]
How to create different woocommerce single_product.php pages for each product? [closed]
How to create different woocommerce single_product.php pages for each product? [closed]
Look into the WP_Fatal_Error_Handler class. I see a couple of filters in its display_default_error_template() method that might be helpful for you: wp_php_error_args wp_php_error_message The entire class is a drop-in, so if you need to you can replace it entirely with your own version, but I think one of those filters—probably wp_php_error_args—might be what you’re looking … Read more
Due to the ‘ vs ‘ that was already mentioned and since your code logic is correct, I suggest you make sure you’re comparing integers, not strings. PHP can be surprising when working with strings as numbers, so cast them as int. Also, make sure you’re getting the correct values by adding $post_id, like this: … Read more
Something in your theme is not written properly. I can’t tell you what it is exactly as I don’t know what your code is. Seeing as that code is supposed to be php, and is being shown on your page, I am going to assume that there is no <?php ?> tags around it, and … Read more
Following the suggestion by @1inmillion, I put the second filter inside the first IF statement, which works nicely. This is the combined code: // 1. Add text below short description function bja_product_unavailable_text( $content ) { $content .= ‘<div class=”bja_product_unavailable”>This product is unavailable</div>’; return $content; } // 2. Remove add to cart button if product is … Read more
Sure, we can modify meta tags in WordPress using actions and filters. The <title> tag is pretty easy, WP already has a filter called document_title_parts that allows you to manipulate the title before being outputted to the page. Here’s a simplified example of using it : add_filter( ‘document_title_parts’, ‘filter_document_title_parts’, 10, 1 ); function filter_document_title_parts( $title_parts … Read more
I’m not 100% sure if I understand your question 100%, but WordPress, by default, displays the caption if it’s filled on the image. Then it displays it just below the image once the image is inserted. Here is an example where I just filled it out on one image 👇
You can try allowing mimes yourself, like this : add_filter(‘upload_mimes’, ‘custom_upload_mimes’); function custom_upload_mimes($existing_mimes) { $existing_mimes[‘rbxlx’] = ‘text/xml’; $existing_mimes[‘rbxlm’] = ‘text/xml’; $existing_mimes[‘rbxl’] = ‘text/xml’; return $existing_mimes; } If this doesn’t help, you need to look outside WP – it’s possible the server itself won’t allow those uploads. Can you access the .htaccess ? If so, you … Read more
It appears this is a known issue with the block editor (aka Gutenberg). That Trac ticket suggests a workaround, too: replace your if ( ! is_admin() ) { … } with something like this: global $current_screen; if ( ( ! is_admin() ) && ( ! ( // Checks the value of WP_Screen::is_block_editor(). $current_screen instanceof \WP_Screen … Read more
The WooCommerce Cart add_to_cart function takes a parameter for cart_item_data. To make this work, you simply need to pass the addon data to add_to_cart. Something like this: $addons = array( array( “name” => “Size”, “value” => “2.5×7”, “price” => 0, “field_name” => “5186-0”, “field_type” => “multiple_choice”, “id” => “1683555538”, “price_type” => “flat_fee” ), array( “name” … Read more