Exclude specific product tags from related products in WooCommerce 3+ [closed]

The first parameter of the filter gets its value from function wc_get_product_term_ids: http://hookr.io/filters/woocommerce_get_related_product_tag_terms/ This function returns an array of term_ids instead of objects: https://docs.woocommerce.com/wc-apidocs/source-function-wc_get_product_term_ids.html#860-871 So you can match the term id values directly or you can use get_term_by to get one of the term objects in the comparison. e.g. getting the term on the right … Read more

Shortcode to include PHP file, pass various parameters to include?

Thanks for your comments and guidance. I implemented solutions which didn’t reinvent the wheel. The complication was finding a way to remove the [insert_php][/insert_php] wrapped code from pages and posts and still preserve the content and user experience. Custom Template Pages Pages and Posts which were almost entirely PHP were made into custom template files. … Read more

How to dynamically change webcam photo timestamps

to generate the galerie, you can put this shortcode in the file functions.php of your theme (create a child theme if the theme can be updated) add_shortcode(“webcamPictures”, function ($attr, $content, $tag) { $picturesByLine = 5; $directoryBase = realpath(__DIR__ . “/../../../images”); $urlBase = home_url(“/images”); // reading pictures $picturesRaw = glob(“$directoryBase/{$attr[“type”]}*”); $pictures = []; foreach ($picturesRaw as … Read more

Adding slides to an existing carousel manually

No it would not be a viable solution. Never hard-code content like that. Assuming you have a slider, you should create a custom post type (or use a plugin like ACF to create a repeater field. Then you’d query a loop of either said posts or fields, and create the appropriate html markup. That way … Read more

Check radio get value to array

First, let’s put all the “payvalue” radio options into an array. This will allow us to then display them all using a foreach loop to reduce redundancy and the chance to make a mistake: $payValueOptions = [126500000, 252000000, 503000000]; Now, let’s render the fields in a foreach loop: $selectedPayValue = $_GET[‘price’]; foreach ($payValueOptions as $option): … Read more