This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $('.profile-gift__copy').on('click', function (e) { | |
| e.preventDefault() | |
| $(this).siblings('.form-control').select() | |
| document.execCommand('copy') | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| ini_set('display_errors', 1); | |
| ini_set('display_startup_errors', 1); | |
| error_reporting(E_ALL); | |
| error_reporting(E_WARNING); | |
| error_reporting(E_NOTICE); | |
| // source: https://stackify.com/display-php-errors/#:~:text=Quickly%20Show%20All%20PHP%20Errors,1)%3B%20error_reporting(E_ALL)%3B |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_action( 'woocommerce_single_product_summary', 'artlife_add_brand_name_to_product_page', 19 ); | |
| function artlife_add_brand_name_to_product_page() { | |
| global $post; | |
| $brands = wp_get_post_terms( $post->ID, 'product_brand', array("fields" => "all") ); | |
| foreach( $brands as $brand ) { | |
| echo __( 'Brand', 'pharmacy') . ': ' . $brand->name; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_filter( 'woocommerce_structured_data_product', 'custom_set_extra_schema', 20, 2 ); | |
| function custom_set_extra_schema( $schema, $product ) { | |
| $gtin = get_post_meta( $product->get_id(), '_custom_gtin', true ); | |
| $schema['gtin13'] = $gtin; | |
| return $schema; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function add_rel_preload($html, $handle, $href, $media) { | |
| if (is_admin()) | |
| return $html; | |
| $html = <<<EOT | |
| <link rel='preload' as='style' onload="this.onload=null;this.rel='stylesheet'" | |
| id='$handle' href='$href' type='text/css' media='all' /> | |
| EOT; | |
| return $html; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Not all the browsers accept WEBP image format but you can type a code to check if the browser accept WEBP format then you will have to make a new images cache and convert the existing images to webp | |
| on the fir dir catalog/model/tool/image.php add | |
| $image_new_webp = 'cachewebp/' . utf8_substr($filename, 0, utf8_strrpos($filename, '.')) . '-' . (int)$width . 'x' . (int)$height . '.webp'; | |
| after this | |
| $image_new = 'cache/' | |
| to check if the browser accept image.webp and to create your new images cache in the same file: catalog/model/tool/image.php add this code: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php echo do_shortcode('[best_selling_products per_page="12" orderby="popularity" order="DESC"]'); ?> | |
| OR | |
| <?php | |
| $args = array( | |
| 'post_type' => 'product', | |
| 'meta_key' => 'total_sales', | |
| 'orderby' => 'meta_value_num', | |
| 'posts_per_page' => 12, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (typeof yourFunctionName == 'function') { | |
| yourFunctionName(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # BEGIN Redirects | |
| RewriteEngine On | |
| # 301 redirect www to non-www | |
| RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] | |
| RewriteRule ^(.*)$ https://%1/$1 [R=301,L] | |
| # 301 redirect to https | |
| RewriteCond %{HTTPS} off | |
| RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
| # END Redirects |