remove conditional tags for calling page_head file, add minimum required version of Gantry to hydrogen with notices, updated changelog

This commit is contained in:
NewKind
2015-10-30 12:58:17 +01:00
parent 6f47c4ba6c
commit fcebcba712
13 changed files with 38 additions and 11 deletions
+11
View File
@@ -1,3 +1,14 @@
# 5.2.1
## XX/XX/XXXX
1. [Common](#common)
2. [Joomla](#joomla)
3. [WordPress](#wordpress)
1. [](#new)
- Hydrogen now requires Gantry 5.2.0 or higher and will display a notice if theme requirements aren't met
2. [](#improved)
- Removed Hydrogen conditional tags for loading page_head.html.twig file
# 5.2.0
## 29/10/2015
+1 -1
View File
@@ -23,6 +23,6 @@ $theme->setLayout('_error', true);
// We need to render contents of <head> before plugin content gets added.
$context = Timber::get_context();
$context['page_head'] = $gantry->isCompatible('5.1.5') ? $theme->render('partials/page_head.html.twig', $context) : null;
$context['page_head'] = $theme->render('partials/page_head.html.twig', $context);
Timber::render('404.html.twig', $context);
+1 -1
View File
@@ -24,7 +24,7 @@ $theme = $gantry['theme'];
// We need to render contents of <head> before plugin content gets added.
$context = Timber::get_context();
$context['page_head'] = $gantry->isCompatible('5.1.5') ? $theme->render('partials/page_head.html.twig', $context) : null;
$context['page_head'] = $theme->render('partials/page_head.html.twig', $context);
$templates = ['archive.html.twig', 'index.html.twig'];
+1 -1
View File
@@ -21,7 +21,7 @@ $theme = $gantry['theme'];
// We need to render contents of <head> before plugin content gets added.
$context = Timber::get_context();
$context['page_head'] = $gantry->isCompatible('5.1.5') ? $theme->render('partials/page_head.html.twig', $context) : null;
$context['page_head'] = $theme->render('partials/page_head.html.twig', $context);
$context['posts'] = Timber::get_posts();
+1 -1
View File
@@ -19,7 +19,7 @@ $theme = $gantry['theme'];
// We need to render contents of <head> before plugin content gets added.
$context = Timber::get_context();
$context['page_head'] = $gantry->isCompatible('5.1.5') ? $theme->render('partials/page_head.html.twig', $context) : null;
$context['page_head'] = $theme->render('partials/page_head.html.twig', $context);
$context['posts'] = Timber::query_post();
$context['content'] = TimberHelper::ob_function('the_content');
+1 -1
View File
@@ -19,7 +19,7 @@ $theme = $gantry['theme'];
// We need to render contents of <head> before plugin content gets added.
$context = Timber::get_context();
$context['page_head'] = $gantry->isCompatible('5.1.5') ? $theme->render('partials/page_head.html.twig', $context) : null;
$context['page_head'] = $theme->render('partials/page_head.html.twig', $context);
$context['posts'] = Timber::query_post();
$context['content'] = TimberHelper::ob_function('the_content');
+16
View File
@@ -15,6 +15,22 @@ defined('ABSPATH') or die;
// Bootstrap Gantry framework or fail gracefully.
$gantry = include_once dirname(__FILE__) . '/includes/gantry.php';
// Check min. required version of Gantry 5
$requiredGantryVersion = '5.2.0';
if (!$gantry->isCompatible($requiredGantryVersion)) {
$current_theme = wp_get_theme();
$error = sprintf(__('Please upgrade Gantry 5 Framework to v%s (or later) before using %s theme!', 'g5_requiem'), strtoupper($requiredGantryVersion), $current_theme->get('Name'));
if(is_admin()) {
add_action('admin_notices', function () use ($error) {
echo '<div class="error"><p>' . $error . '</p></div>';
});
} else {
wp_die($error);
}
}
/** @var \Gantry\Framework\Theme $theme */
$theme = $gantry['theme'];
+1 -1
View File
@@ -20,7 +20,7 @@ $theme = $gantry['theme'];
// We need to render contents of <head> before plugin content gets added.
$context = Timber::get_context();
$context['page_head'] = $gantry->isCompatible('5.1.5') ? $theme->render('partials/page_head.html.twig', $context) : null;
$context['page_head'] = $theme->render('partials/page_head.html.twig', $context);
$GLOBALS['timberContext'] = $context;
+1 -1
View File
@@ -28,7 +28,7 @@ $theme = $gantry['theme'];
// We need to render contents of <head> before plugin content gets added.
$context = Timber::get_context();
$context['page_head'] = $gantry->isCompatible('5.1.5') ? $theme->render('partials/page_head.html.twig', $context) : null;
$context['page_head'] = $theme->render('partials/page_head.html.twig', $context);
$context['posts'] = Timber::get_posts();
+1 -1
View File
@@ -23,6 +23,6 @@ $theme->setLayout('_offline', true);
// We need to render contents of <head> before plugin content gets added.
$context = Timber::get_context();
$context['page_head'] = $gantry->isCompatible('5.1.5') ? $theme->render('partials/page_head.html.twig', $context) : null;
$context['page_head'] = $theme->render('partials/page_head.html.twig', $context);
Timber::render('offline.html.twig', $context);
+1 -1
View File
@@ -31,7 +31,7 @@ $theme = $gantry['theme'];
// We need to render contents of <head> before plugin content gets added.
$context = Timber::get_context();
$context['page_head'] = $gantry->isCompatible('5.1.5') ? $theme->render('partials/page_head.html.twig', $context) : null;
$context['page_head'] = $theme->render('partials/page_head.html.twig', $context);
$post = Timber::query_post();
$context['post'] = $post;
+1 -1
View File
@@ -19,7 +19,7 @@ $theme = $gantry['theme'];
// We need to render contents of <head> before plugin content gets added.
$context = Timber::get_context();
$context['page_head'] = $gantry->isCompatible('5.1.5') ? $theme->render('partials/page_head.html.twig', $context) : null;
$context['page_head'] = $theme->render('partials/page_head.html.twig', $context);
$context['title'] = __('Search results for:', 'g5_hydrogen') . ' ' . get_search_query();
$context['posts'] = Timber::get_posts();
+1 -1
View File
@@ -19,7 +19,7 @@ $theme = $gantry['theme'];
// We need to render contents of <head> before plugin content gets added.
$context = Timber::get_context();
$context['page_head'] = $gantry->isCompatible('5.1.5') ? $theme->render('partials/page_head.html.twig', $context) : null;
$context['page_head'] = $theme->render('partials/page_head.html.twig', $context);
$post = Timber::query_post();