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
| //The field I use is a single line field and not phone field. Using a custom mask since client has specific format for phone. Add to functions.php of your child theme. | |
| //for mobile | |
| add_filter( 'gform_field_validation_4_6', 'validate_phone', 10, 4 ); // just replace / remove _4_6 since I am targetting a specific field | |
| function validate_phone( $result, $value, $form, $field ) { | |
| $pattern = "/^0(4)\d{8}$/"; //regex pattern that make sure it starts with "04" and must be total of 10 numbers only. | |
| if (!preg_match( $pattern, $value ) ) { | |
| $result['is_valid'] = false; | |
| $result['message'] = 'Invalid mobile number.'; |
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
| // Move Yoast to bottom | |
| function yoasttobottom() { | |
| return 'low'; | |
| } | |
| add_filter( 'wpseo_metabox_prio', 'yoasttobottom'); |
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
| //** *Enable upload for webp image files.*/ | |
| function webp_enable_mimes($existing_mimes) { | |
| $existing_mimes['webp'] = 'image/webp'; | |
| return $existing_mimes; | |
| } | |
| add_filter('mime_types', 'webp_enable_mimes'); |
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
| // Get Product ID | |
| $product->get_id(); (fixes the error: "Notice: id was called incorrectly. Product properties should not be accessed directly") | |
| // Get Product General Info | |
| $product->get_type(); | |
| $product->get_name(); | |
| $product->get_slug(); | |
| $product->get_date_created(); | |
| $product->get_date_modified(); | |
| $product->get_status(); | |
| $product->get_featured(); |
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
| /* | |
| Theme Name: CHILD THEME NAME | |
| Theme URI: https://nilrezane.net | |
| Description: CHILD THEME NAME description | |
| Author: John Doe | |
| Author URI: https://nilrezane.net | |
| Template: twentyfifteen | |
| Version: 1.0.0 | |
| License: GNU General Public License v2 or later | |
| License URI: http://www.gnu.org/licenses/gpl-2.0.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
| function shortcodecustom_func() { | |
| if ( have_rows( 'tabs_section' ) ): | |
| while ( have_rows( 'tabs_section' ) ): the_row(); | |
| $content .= sprintf('<div class="classhere-1"> | |
| <div class="containerclass-1"> | |
| <div class="row">'); | |
| $content .= sprintf('<div class="row"> | |
| <div class="col-md-4"> | |
| <h2 class="display-1 text-secondary">%s</h2></div>', get_sub_field( 'section_title' )); | |
| $content .= sprintf( '<div class="col-md-4"> |
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 the code to your functions.php | |
| ini_set('log_errors','On'); | |
| ini_set('display_errors','Off'); | |
| ini_set('error_reporting', E_ALL ); | |
| define('WP_DEBUG', false); | |
| define('WP_DEBUG_LOG', true); | |
| define('WP_DEBUG_DISPLAY', false); |