Changeset 1920489
- Timestamp:
- 08/06/2018 03:51:33 PM (8 years ago)
- Location:
- basepress/trunk
- Files:
-
- 5 edited
-
basepress.php (modified) (2 diffs)
-
includes/class-basepress-cpt.php (modified) (5 diffs)
-
includes/class-basepress-utils.php (modified) (2 diffs)
-
public/class-basepress-search.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
basepress/trunk/basepress.php
r1920390 r1920489 5 5 * Plug URI: http://www.8bitsinarow.com 6 6 * Description: The perfect Knowledge Base plugin for WordPress 7 * Version: 1.8. 67 * Version: 1.8.7 8 8 * Author: 8Bits in a row 9 9 * Author URI: http://www.8bitsinarow.com … … 73 73 * @var string 74 74 */ 75 public $ver = '1.8. 6' ;75 public $ver = '1.8.7' ; 76 76 /** 77 77 * Database version -
basepress/trunk/includes/class-basepress-cpt.php
r1920390 r1920489 19 19 public function __construct() 20 20 { 21 global $basepress_utils ; 21 22 //Add rewrite rules to handle links properly 22 23 add_filter( 'rewrite_rules_array', array( $this, 'rewrite_rules' ) ); … … 57 58 add_action( 'admin_notices', array( $this, 'missing_data_notice' ) ); 58 59 $this->options = get_option( 'basepress_settings' ); 59 $this->kb_slug = $ this->get_kb_slug();60 $this->kb_slug = $basepress_utils->get_kb_slug(); 60 61 $this->register_taxonomy(); 61 62 $this->register_post_type(); … … 63 64 64 65 /** 65 * Gets the KB slug including parents pages if exists66 *67 * @since 1.7.968 *69 * @return string70 */71 public function get_kb_slug()72 {73 $entry_page = ( isset( $this->options['entry_page'] ) ? $this->options['entry_page'] : 0 );74 /**75 * Filters the entry page ID before use76 */77 $entry_page = apply_filters( 'basepress_entry_page', $entry_page );78 $parents = get_ancestors( $entry_page, 'page' );79 $kb_slug = get_post_field( 'post_name', $entry_page );80 foreach ( $parents as $parent ) {81 $parent_slug = get_post_field( 'post_name', $parent );82 $kb_slug = $parent_slug . '/' . $kb_slug;83 }84 $this->kb_slug = $kb_slug;85 return $kb_slug;86 }87 88 /**89 66 * Adds rewrite rules for Basepress post type 90 67 * Called by flush_rewrite rules … … 98 75 public function rewrite_rules( $rules ) 99 76 { 100 global $wp_rewrite ;77 global $wp_rewrite, $basepress_utils ; 101 78 $options = get_option( 'basepress_settings' ); 102 79 //If the entry page has not been set skip the rewrite rules … … 104 81 return $rules; 105 82 } 106 $kb_slug = $ this->get_kb_slug();83 $kb_slug = $basepress_utils->get_kb_slug(); 107 84 /** 108 85 * Filter the kb_slug before generating the rewrite rules -
basepress/trunk/includes/class-basepress-utils.php
r1886888 r1920489 13 13 class Basepress_Utils { 14 14 15 private $kb_slug = null; 15 16 private $product = null; 16 17 private $sections = null; … … 326 327 } 327 328 329 330 /** 331 * Gets the KB slug including parents pages if exists 332 * 333 * @since 1.7.9 334 * 335 * @return string 336 */ 337 public function get_kb_slug(){ 338 339 if( $this->kb_slug ){ 340 return $this->kb_slug; 341 } 342 343 $entry_page = isset( $this->options['entry_page'] ) ? $this->options['entry_page'] : 0; 344 345 /** 346 * Filters the entry page ID before use 347 */ 348 $entry_page = apply_filters( 'basepress_entry_page', $entry_page ); 349 350 $parents = get_ancestors( $entry_page, 'page' ); 351 $kb_slug = get_post_field( 'post_name', $entry_page ); 352 353 foreach( $parents as $parent ){ 354 $parent_slug = get_post_field( 'post_name', $parent ); 355 $kb_slug = $parent_slug . '/' . $kb_slug; 356 } 357 $this->kb_slug = $kb_slug; 358 return $kb_slug; 359 } 328 360 329 361 -
basepress/trunk/public/class-basepress-search.php
r1920390 r1920489 91 91 */ 92 92 public function render_searchbar( $product = '' ) { 93 global $wp; 94 global $basepress_utils; 93 global $wp, $basepress_utils; 95 94 96 95 if ( ! $product ) { … … 101 100 $placeholder = isset( $options['search_field_placeholder'] ) ? $options['search_field_placeholder'] : ''; 102 101 $search_terms = isset( $wp->query_vars['s'] ) ? urldecode( $wp->query_vars['s'] ) : ''; 103 $kb_slug = isset( $options['entry_page'] ) ? get_post_field( 'post_name', $options['entry_page'] ) : '';102 $kb_slug = $basepress_utils->get_kb_slug(); 104 103 105 104 /** -
basepress/trunk/readme.txt
r1920390 r1920489 5 5 Requires at least: 4.5 6 6 Tested up to: 4.9 7 Stable tag: 1.8. 67 Stable tag: 1.8.7 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 138 138 == Changelog == 139 139 140 = 1.8.7 = 141 * Fixed bug for searches when the KB is in sub-page 142 140 143 = 1.8.6 = 141 144 * Improved search results to move exact matches on top
Note: See TracChangeset
for help on using the changeset viewer.