WordPress @include( ‘template-config.php’ );

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

Add text below WooCommerce short description if metabox value is true

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

Adding caption to all images inside an article

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 👇

PHP Add products to cart with WooCommerce Addons

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

How can I update a value of a field depending on outside source?

you can read your file using standard PHP: $value = json_decode( file_get_contents( ‘path/to/your/file.json’ ) ); Then you can use WordPress function to update post meta: update_post_meta( $post_id, $meta_name, $value, $prev_value ); $post_id = ID of the post you want to update $meta_name = name of the meta field you want to update $value = new … Read more