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 | |
| // Running No. Slug | |
| add_action('wp_insert_post', 'change_slug'); | |
| function change_slug($post_id, $force = false) | |
| { | |
| $post_types = ['news', 'faq']; | |
| $post_type = $_POST['post_type']; | |
| if (!in_array($post_type, $post_types) || get_field('no', $post_id)) { | |
| return; |
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
| ._th:not(:lang(th)), | |
| ._en:not(:lang(en-US)) { | |
| display: none !important; | |
| } |
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
| // GENERATEBLOCKS CSS | |
| if (function_exists('generateblocks_get_frontend_block_css')) { | |
| add_filter('the_content', 'p_css'); | |
| } | |
| function p_css($content) { | |
| global $post; | |
| $css = wp_strip_all_tags(generateblocks_get_frontend_block_css()); | |
| return '<style id="gb-css">' . $css . '</style>' . $content; |
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 | |
| // Custom Field: demo_field | |
| // Shortcode: [show_field] | |
| function show_custom_field() { | |
| $meta = get_post_meta( get_the_ID(), 'demo_field', true ); | |
| return '<em>' . $meta . '</em>'; | |
| } | |
| add_shortcode('show_field', 'show_custom_field'); |
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 | |
| add_filter('sstp_views', 'sstp_change_views',10, 2 ); | |
| function sstp_change_views($num, $postID) { | |
| if ($postID == 123) { | |
| return $num + 500; | |
| } | |
| return $num; | |
| } |
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
| <div class="most-popular"> | |
| <?php | |
| $args = array( | |
| 'posts_per_page' => 5, | |
| 'orderby' => 'meta_value_num', | |
| 'order' => 'DESC', | |
| 'meta_key' => 's_stat', | |
| 'date_query' => array( | |
| 'after' => '30 days ago' | |
| ) |
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 | |
| add_action( 'forminator_form_after_handle_submit', 'ws_get_message', 10, 2 ); | |
| add_action( 'forminator_form_after_save_entry', 'ws_get_message', 10, 2 ); | |
| // เก็บข้อความจากฟอร์มแล้วส่งไลน์ | |
| function ws_get_message($form_id, $response) { | |
| // ===แก้ตรงนี้===== |
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 // Show related post from "Related Posts for WordPress By Never5" WordPress Plugin | |
| $p_id = get_the_ID(); | |
| $link_args = array( | |
| 'post_type' => 'rp4wp_link', | |
| 'posts_per_page' => 6, | |
| 'meta_query' => array( | |
| array( | |
| 'key' => 'rp4wp_parent', |
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
| jQuery(document).ready(function ($) { | |
| acf.add_filter("date_picker_args", function (args, $field) { | |
| if ($field.hasClass("birth_date")) { | |
| args["minDate"] = "-8y"; //ref: https://api.jqueryui.com/datepicker/ | |
| args["maxDate"] = "-1d"; | |
| } | |
| return args; | |
| }); | |
| }); |
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 | |
| // from https://github.com/sybrew/the-seo-framework/issues/541 | |
| add_filter( 'the_seo_framework_image_generation_params', function( $params ) { | |
| unset( $params['cbs']['content'] ); | |
| return $params; | |
| } ); |