Change WooCommerce product price based on category and GEO IP country

WooCommerce has already a Geo IP feature that you can use through WC_Geolocation Class. I have revisited completely your code. To target a product category you can use WordPress has_term() function on WooCommerce Product Category custom taxonomy as follow: function is_geo_country_belgium() { // Get an instance of the WC_Geolocation object class $geolocation_instance = new WC_Geolocation(); … Read more

How do you modify the WordPress directory structure?

Looking at your proposed structure, I am assuming that the only thing that would be changed is: The WordPress files are all kept in a folder you’ve called web. For this just create a .htaccess file in root folder, and put this content inside (just change example.com): <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP_HOST} ^(www.)?example.com$ RewriteCond … Read more

Setting custom search engine indexing for a “dynamic WordPress page” with htaccess

You’ll need the Header set …. directive, but to set it conditionally based on the URL. One way of doing this is to use mod_rewrite to set an environment variable (eg. ROBOTS_INDEX) when your URL criteria are met (for the URLs you want indexed) and use the env= argument to the Header directive to conditionally … Read more

Dynamic title in WordPress homepage

Actually the above code (reposted below) worked perfectly. Guess it was a cache issue that it did not get reflected. Thanks for your time! add_filter(‘wpseo_title’, ‘filter_keral_wpseo_title’); function filter_keral_wpseo_title($title) { if( is_front_page() ) { $recent = get_posts(array( ‘author’=>1, ‘orderby’=>’date’, ‘order’=>’desc’, ‘numberposts’=>1 )); if( $recent ){ $title = get_the_title($recent[0]->ID); } } return $title; }

Send a custom WooCommerce email when custom order change [closed]

I think you need do two changes: Add a filter to woocommerce_email_actions that adds the action hook which should trigger the notification: function add_ready_to_ship_woocommerce_email_action( $email_actions ) { $email_actions[] = ‘woocommerce_order_status_ready-to-ship’; return $email_actions; } add_filter( ‘woocommerce_email_actions’, ‘add_ready_to_ship_woocommerce_email_action’ ); Change the trigger hook in the email class (add a _notification suffix): // Trigger on new paid orders … Read more

Is there a way to dynamically get to your uploads folder?

Take a look at wp_upload_dir here https://developer.wordpress.org/reference/functions/wp_upload_dir/ $upload_dir = wp_upload_dir(); var_dump( $upload_dir ); /* $upload_dir will comprise of the following return values: ‘path’ – (string) Base directory and subdirectory or full path to upload directory. ‘url’ – (string) Base URL and subdirectory or absolute URL to upload directory. ‘subdir’ – (string) Subdirectory if uploads use … Read more

How to add “Read More…” link in twentytwenty

By going to the Theme Editor, you can add the following snippet at the end of the functions.php file: function twentytwentychild_excerpt_more_add_continue_reading( $more ) { return ‘ […] <div class=”read-more-button-wrap”><a href=”‘ . get_permalink( get_the_ID() ) . ‘” class=”more-link”><span class=”faux-button”>Continue reading</span> <span class=”screen-reader-text”>“’ . get_the_title( get_the_ID() ) . ‘”</span></a></div>’; } add_filter(‘excerpt_more’, ‘twentytwentychild_excerpt_more_add_continue_reading’ ); Source: https://wordpress.org/support/topic/continue-reading-doesnt-appear/

Add custom user profile field to default WordPress MultiSite registration form

I finely made it work this way: // Sending custom field data to $meta add_filter(‘add_signup_meta’, ‘sb_add_signup_meta’); function sb_add_signup_meta($meta) { if( isset( $_POST[‘phone_number’] ) ) { $phone_number = filter_var( $_POST[‘phone_number’], FILTER_SANITIZE_NUMBER_INT ); $meta[‘phone_number’] = $phone_number; return $meta; } else return $meta; } // Updating user meta on user activation. Works only if user chose registration without … Read more

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