Changeset 2839607
- Timestamp:
- 12/27/2022 03:07:39 AM (3 years ago)
- Location:
- lbk-faqs-schema
- Files:
-
- 15 added
- 3 edited
-
tags/1.2.0 (added)
-
tags/1.2.0/.gitattributes (added)
-
tags/1.2.0/.gitignore (added)
-
tags/1.2.0/LICENSE (added)
-
tags/1.2.0/css (added)
-
tags/1.2.0/css/admin.css (added)
-
tags/1.2.0/css/front.css (added)
-
tags/1.2.0/faq-schema.php (added)
-
tags/1.2.0/includes (added)
-
tags/1.2.0/includes/class.admin.php (added)
-
tags/1.2.0/includes/function.php (added)
-
tags/1.2.0/js (added)
-
tags/1.2.0/js/admin.js (added)
-
tags/1.2.0/js/front.js (added)
-
tags/1.2.0/readme.txt (added)
-
trunk/faq-schema.php (modified) (previous)
-
trunk/includes/class.admin.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (previous)
Legend:
- Unmodified
- Added
- Removed
-
lbk-faqs-schema/trunk/includes/class.admin.php
r2837759 r2839607 31 31 add_action( 'save_post', array( $this, 'lbk_custom_faq_save' ) ); 32 32 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_script' ) ); 33 add_action( 'restrict_manage_posts', array( $this, 'post_has_faqs_filter' ) ); 34 add_filter( 'parse_query', array( $this, 'post_has_faqs_filter_results' ) ); 33 35 } 34 36 … … 139 141 } 140 142 143 public function post_has_faqs_filter() { 144 $values = array( 145 'Bài viết có FAQs' => 'posts_have_faqs' 146 ); 147 ?> 148 <select name="faqs_post_filter"> 149 <option value=""><?php _e('Tất cả bài viết ', 'lbk-faqs'); ?></option> 150 <?php 151 $current_v = isset($_GET['faqs_post_filter'])? $_GET['faqs_post_filter']:''; 152 foreach ($values as $label => $value) { 153 printf( 154 '<option value="%s" %s>%s</option>', 155 $value, 156 $value == $current_v? ' selected="selected"':'', 157 $label 158 ); 159 } 160 ?> 161 </select> 162 <?php 163 } 164 165 public function post_has_faqs_filter_results($query){ 166 global $pagenow; 167 if ( is_admin() && $pagenow=='edit.php' && isset($_GET['faqs_post_filter']) && $_GET['faqs_post_filter'] == 'posts_have_faqs' ) { 168 $query->query_vars['meta_key'] = '_lbk_custom_faqs'; 169 } 170 } 171 141 172 /** 142 173 * Enqueue scripts
Note: See TracChangeset
for help on using the changeset viewer.