This repository has been archived by the owner on Jan 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
155 additions
and
76 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,13 @@ | ||
<?php | ||
/** | ||
* Theme functions file. | ||
* AMP Travel Theme. | ||
* | ||
* @package WPAMPTheme | ||
*/ | ||
|
||
// Include required classes. | ||
require_once get_template_directory() . '/includes/class-amp-travel-blocks.php'; | ||
require_once get_template_directory() . '/includes/class-amp-travel-taxonomies.php'; | ||
// Load theme. | ||
require_once get_template_directory() . '/includes/functions.php'; | ||
require_once get_template_directory() . '/includes/class-amp-travel-theme.php'; | ||
|
||
if ( ! function_exists( 'travel_setup' ) ) : | ||
/** | ||
* Sets up theme defaults and registers support for various WordPress features. | ||
* | ||
* Note that this function is hooked into the after_setup_theme hook, which | ||
* runs before the init hook. The init hook is too late for some features, such | ||
* as indicating support for post thumbnails. | ||
*/ | ||
function travel_setup() { | ||
/* | ||
* Make theme available for translation. | ||
* Translations can be filed in the /languages/ directory. | ||
* If you're building a theme based on WPAMPTheme, use a find and replace | ||
* to change 'travel' to the name of your theme in all the template files. | ||
*/ | ||
load_theme_textdomain( 'travel', get_template_directory() . '/languages' ); | ||
|
||
add_theme_support( 'amp', array() ); | ||
|
||
// Init blocks. | ||
new AMP_Travel_Blocks(); | ||
new AMP_Travel_Taxonomies(); | ||
} | ||
endif; | ||
|
||
// Hook into theme after setup. | ||
add_action( 'after_setup_theme', 'travel_setup' ); | ||
// Initialize theme. | ||
amp_travel_theme()->init(); |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?php | ||
/** | ||
* AMP Travel Theme class. | ||
* | ||
* @package WPAMPTheme | ||
*/ | ||
|
||
/** | ||
* Class AMP_Travel_Theme. | ||
* | ||
* @package WPAMPTheme | ||
*/ | ||
class AMP_Travel_Theme { | ||
|
||
/** | ||
* AMP_Travel_Theme constructor. | ||
*/ | ||
protected function __construct() { | ||
$this->includes(); | ||
$this->instantiate_classes(); | ||
} | ||
|
||
/** | ||
* Init classes. | ||
*/ | ||
protected function instantiate_classes() { | ||
|
||
// Init blocks. | ||
$travel_blocks = new AMP_Travel_Blocks(); | ||
$travel_blocks->init(); | ||
|
||
// Init taxonomies. | ||
$travel_taxonomies = new AMP_Travel_Taxonomies(); | ||
$travel_taxonomies->init(); | ||
} | ||
|
||
/** | ||
* Init. | ||
*/ | ||
public function init() { | ||
|
||
// Hook into theme after setup. | ||
add_action( 'after_setup_theme', array( $this, 'setup' ) ); | ||
} | ||
|
||
/** | ||
* Get theme instance. | ||
* | ||
* @return object $instance Theme instance. | ||
*/ | ||
public static function get_instance() { | ||
static $instance; | ||
|
||
if ( ! $instance instanceof AMP_Travel_Theme ) { | ||
$instance = new AMP_Travel_Theme(); | ||
} | ||
|
||
return $instance; | ||
} | ||
|
||
/** | ||
* Setup. | ||
*/ | ||
public function setup() { | ||
/* | ||
* Make theme available for translation. | ||
* Translations can be filed in the /languages/ directory. | ||
* If you're building a theme based on WPAMPTheme, use a find and replace | ||
* to change 'travel' to the name of your theme in all the template files. | ||
*/ | ||
load_theme_textdomain( 'travel', get_template_directory() . '/languages' ); | ||
|
||
add_theme_support( 'amp', array() ); | ||
} | ||
|
||
/** | ||
* Theme includes. | ||
*/ | ||
protected function includes() { | ||
$dir = get_template_directory(); | ||
|
||
require_once $dir . '/includes/class-amp-travel-taxonomies.php'; | ||
require_once $dir . '/includes/class-amp-travel-blocks.php'; | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
/** | ||
* Theme functions file. | ||
* | ||
* @package WPAMPTheme | ||
*/ | ||
|
||
/** | ||
* Init theme. | ||
* | ||
* @return object Theme object | ||
*/ | ||
function amp_travel_theme() { | ||
return AMP_Travel_Theme::get_instance(); | ||
} |