Skip to content

Commit

Permalink
FIX: adding custom page template for WP 4.7
Browse files Browse the repository at this point in the history
  • Loading branch information
MjHead committed Dec 30, 2016
1 parent c270143 commit 9e53e05
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cherry-portfolio.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Cherry Portfolio
* Plugin URI: http://www.cherryframework.com/
* Description: A portfolio plugin for WordPress.
* Version: 1.0.4.8
* Version: 1.0.4.9
* Author: Cherry Team
* Author URI: http://www.cherryframework.com/
* Text Domain: cherry-portfolio
Expand Down Expand Up @@ -88,7 +88,7 @@ function constants() {
*
* @since 1.0.0
*/
define( 'CHERRY_PORTFOLIO_VERSION', '1.0.4.8' );
define( 'CHERRY_PORTFOLIO_VERSION', '1.0.4.9' );

/**
* Set the slug of the plugin.
Expand Down
11 changes: 11 additions & 0 deletions public/includes/classes/class-cherry-portfolio-page-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public function __construct() {
// Add a filter to load a custom template for a given post.
add_filter( 'single_template', array( $this, 'get_single_template' ) );

add_filter( 'theme_page_templates', array( $this, 'add_templates' ) );

// Add your templates to this array.
$this->templates = array(
'template-portfolio.php' => __( 'Portfolio', 'cherry-portfolio' ),
Expand All @@ -64,6 +66,15 @@ public function __construct() {

}

/**
* Add services page templates.
*
* @param array $templates Existing templates array.
* @return array
*/
public function add_templates( $templates = array() ) {
return array_merge( $templates, $this->templates );
}

/**
* Adds our template to the pages cache in order to trick WordPress
Expand Down

0 comments on commit 9e53e05

Please sign in to comment.