Add_filter when value is no variable?

I can’t really make sense of what you’re trying to do. This code: apply_filters( ‘cc_get_content_preview’, get_the_excerpt(), 55 ); Will let developers hook into the cc_get_content_preview hook to change the value that the cc_get_content_preview() function returns. When developers hook into an action or filter, they do so using a callback function. This function will receive any … Read more

How to get correct value from checked()?

The purpose of checked() is to output a checked=”checked” attribute based on a current value. By using it the way you’re using it there you’re forcing Si to never be checked and No to always be checked. So what you want to do is use both arguments of checked() to compare the value of the … Read more

Return category name with & Ampersand doesnt work

Using titles in such comparisons is always a little bit risky – you have to deal with encodings and so on. Much safer way is using of slugs in code, because they are url-safe. So your code could look like this: function posend_text_shortcode() { $mycategory = get_the_category(); $slug = ”; if ( ! empty($mycategory) ) … Read more

Add code to Functions.php

Yes. It’s best practice to use a child theme and make your modifications there rather than edit the parent theme directly. This will allow you to to make changes without fear of overwriting your customizations. From the Codex: A child theme inherits the look and feel of the parent theme and all of its functions, … Read more

How to change this simple code so that it sends the email notification after payment in WooCommerce?

The hook you’re looking for is “woocommerce payment complete” and it’s triggered once an order has been marked as “complete”. In the function called by that hook, you need to grab all coupons applied to the order, and check if any of them is the one you’re looking for. add_action( ‘woocommerce_payment_complete’, ‘so_payment_complete’ ); function so_payment_complete( … Read more

Is my code correct to enqueue CSS on a specific page?

Try this: I hope, It will works. Explaination: In below code in “is_page( 42 )” where 42 is page id of about page. So, if about page’s id will be 42 then it’s enqueue the stylesheet for that page only. Also I define particular path for this CSS file by using wordpress function get_template_directory_uri(). function … Read more