Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added theme starter feature #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/Fields/Theme_Fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ public function init() {
$this->add_options_page( 'Theme options' );

$this->has(
$this->build()
$this->build('theme_options', [
'style' => 'seamless',
])
->addTab( 'General' )
->addFields( $this->general_tab() )
->addTab( 'Socials Links' )
Expand Down
5 changes: 0 additions & 5 deletions app/Theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@
use Boilerplate\Theme\Fields\Page_Fields;
use Boilerplate\Theme\Fields\Theme_Fields;
use Boilerplate\Theme\Fields\User_Fields;
use Boilerplate\Theme\Page_Builder\SiteOrigin_Panels;
use Boilerplate\Theme\Post_Type\Employee;
use Boilerplate\Theme\Supports\Autoptimize;
use Boilerplate\Theme\Taxonomy\Department;
use JustCoded\WP\Framework\Supports\Contact_Form7;
use JustCoded\WP\Framework\Supports\Just_Custom_Fields;
use JustCoded\WP\Framework\ACF\ACF_Support;
use JustCoded\WP\Framework\Supports\Just_Post_Preview;
use JustCoded\WP\Framework\Supports\Just_Responsive_Images;
use JustCoded\WP\Framework\Supports\Just_Tinymce;

Expand Down Expand Up @@ -147,8 +144,6 @@ public function register_taxonomies() {
*/
public function support_plugins() {
Just_Responsive_Images::instance();
Just_Custom_Fields::instance();
Just_Post_Preview::instance();
Just_Tinymce::instance();

if ( Autoptimize::check_requirements() ) {
Expand Down
21 changes: 3 additions & 18 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,8 @@
require_once get_template_directory() . '/inc/hooks.php';
require_once get_template_directory() . '/inc/template-funcs.php';

/**
* Wrap theme start code into a function to be able to use child theme.
* this code will be executed inside child theme.
*/
if ( ! function_exists( 'boilerplate_theme_starter' ) ) {
/**
* Theme launcher function
*/
function boilerplate_theme_starter() {
new \JustCoded\WP\Framework\Autoload( 'Boilerplate\Theme', get_template_directory() . '/app' );
$theme = \JustCoded\WP\Framework\Theme_Starter\Theme_Starter::instance();

$theme = \Boilerplate\Theme\Theme::instance();
}
if ( ! $theme->is_theme_created() ) {
$theme->start_theme( 'boilerplate_namespace' );
}

/**
* Finally run our Theme setup
* and ThemeOptions setup
*/
boilerplate_theme_starter();
14 changes: 12 additions & 2 deletions requirements.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class Just_Theme_Framework_Checker {
private function __construct() {
global $pagenow;
if ( ! is_admin() && 'wp-login.php' !== $pagenow && ! $this->check_requirements() ) {
throw new Exception( 'Your theme requires Just Theme Framework and Titan Framework plugins to be installed and activated.' );
throw new Exception( 'Your theme requires WordPress Theme Framework and Advanced Custom Fields PRO plugins to be installed and activated.' );
}
add_action( 'admin_notices', array( $this, 'display_requirements_admin_notice' ) );
}
Expand Down Expand Up @@ -127,7 +127,17 @@ public function display_requirements_admin_notice() {
}

$html = '<div class="error"><h3>Please fix the errors below to use current activated theme:</h3><p>' . implode( '</p><p>', $warnings ) . '</p></div>';
echo wp_kses( $html, array( 'div', 'h3', 'p' ) );
echo wp_kses( $html, array(
'div' => [
'class' => true,
],
'h3' => true,
'p' => true,
'a' => [
'href' => true,
'target' => true,
],
) );
}
}

Expand Down