Target a page with query

I have checked at the source code and found $_GET as a solution to target them. $type = isset($_GET[“type”]) ? $_GET[“type”] : ‘story’; if( is_page(‘post-create-page’) && $type==’story’ ) { ….} elseif ( is_page(‘post-create-page’) && $type==’openlist’ ) {…..}

How to Add text value in Automatically in this conditions?

This should work. Untested though. I don’t know how you get $woocomerce_wookc_text, but since you mentioned CMB, I am taking you are saving it as product meta data function wpse405916_add_to_cart( $cart_item_key, $product_id ) { //Get the woocomerce_wookc_text value. $woocomerce_wookc_text = get_post_meta( $product_id, ‘woocomerce_wookc_text ‘, true ); //Check if the value exists if ( $woocomerce_wookc_text && … Read more

check that the data exists before sending it to wpdb

Hi the error you are getting for $serializedpaisol variable because it is not define in function scope. the variable you define in specific scope can not access out form its scope; eg. { //example scope $var=10; } echo $var; // you will get undefined error. how you can fixed it? Solution // first define variable … Read more

hard code shortcode only on specific category

If you’re embedding the code directly into the template file, why bother with shortcodes? Simply extract the code from the add_shortcode() function call, and add it to your template, wrapped in an appropriate conditional tag, such as in_category(), e.g.: if ( in_category( $cat ) ) { // put shortcode code here } Note: the $cat … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)