Changeset 2947873
- Timestamp:
- 08/04/2023 06:26:32 PM (3 years ago)
- Location:
- wpyog-documents/trunk
- Files:
-
- 2 edited
-
index.php (modified) (6 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wpyog-documents/trunk/index.php
r2936955 r2947873 5 5 Author: WPYog 6 6 Author URI: http://wpyog.com/ 7 Version: 1. 17 Version: 1.3 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 182 182 183 183 add_shortcode('wpyog-document-list', 'wpyog_research_document_list' ); 184 function wpyog_research_document_list($atts ){184 function wpyog_research_document_list($atts, $content=null){ 185 185 global $content, $wpdb; 186 186 ob_start(); 187 188 187 extract(shortcode_atts(array( 189 188 'searchOption' => 'top', … … 196 195 'download' => 0 197 196 ), $atts)); 198 197 $cat = ! empty( $category ) ? explode(',', $category) : ''; 199 198 $args = array ( 200 199 'post_type' => 'wpyog_document', … … 204 203 'order' => $order, 205 204 ); 206 207 if( $category != "" ) { 205 if( $cat != "" ) { 208 206 $args['tax_query'] = array( 209 207 array( 210 208 'taxonomy' => 'wpyog_document_category', 211 209 'field' => 'term_id', 212 'terms' => $cat egory210 'terms' => $cat 213 211 ) 214 212 ); 215 $args = array_merge($args,array('s' => $keywords)); 216 } 217 213 } 218 214 $query = new WP_Query( $args ); 219 215 $includeFile = plugin_dir_path( __FILE__ ).'templates/research-document-list.php'; 220 216 include( $includeFile ); 221 217 $output = ob_get_clean(); 218 $output = wpautop(trim($output)); 222 219 return $output; 223 220 } … … 307 304 </div> 308 305 <?php endwhile; } else { ?> 309 <p>[wpyog-document id=<?php echo $document_id;?>]</p>306 <p>[wpyog-document id=<?php echo implode(',',$document_id);?>]</p> 310 307 <?php } 311 308 //echo "<pre>"; print_r($documentRows); exit; … … 441 438 } 442 439 } 440 441 add_action('init', 'enable_revisions'); 442 function enable_revisions() { 443 add_post_type_support('wpyog_document', 'revisions'); 444 } 445 add_action('save_post', 'create_custom_post_type_revision'); 446 function create_custom_post_type_revision($post_id) { 447 $post_type = get_post_type($post_id); 448 if ($post_type !== 'wpyog_document' || wp_is_post_revision($post_id) || wp_is_post_autosave($post_id)) { 449 return; 450 } 451 wp_save_post_revision($post_id); 452 } -
wpyog-documents/trunk/readme.txt
r2936955 r2947873 20 20 Show only selected Documents: Choose documents selectively by ID and list them into pages, posts or any other post types. 21 21 22 * NEW IN VERSION 1. 222 * NEW IN VERSION 1.3 23 23 * Category Filters allows you to sort your documents easily. 24 24 * Support for post order type, which allows you to custom sort your documents.
Note: See TracChangeset
for help on using the changeset viewer.