Permalink
Browse files

Add primer_current_layout filter, compat dir, docblock fixes

  • Loading branch information...
1 parent 83dd8b9 commit bcd9a07cd5550c57bdf6430effd47038378d5e22 @fjarrett fjarrett committed Sep 10, 2016
Showing with 512 additions and 336 deletions.
  1. +1 −1 404.php
  2. +1 −1 archive.php
  3. +1 −1 comments.php
  4. +1 −1 content-none.php
  5. +1 −1 content-page.php
  6. +1 −1 content-search.php
  7. +1 −1 content.php
  8. +1 −1 footer.php
  9. +25 −6 functions.php
  10. +1 −1 header.php
  11. +109 −0 inc/compat/beaver-builder.php
  12. +1 −0 inc/{ → compat}/jetpack.php
  13. +276 −0 inc/compat/woocommerce.php
  14. +2 −4 inc/{back-compat.php → compat/wordpress.php}
  15. +1 −0 inc/{ → compat}/wpcom.php
  16. +6 −0 inc/customizer.php
  17. +10 −23 inc/customizer/colors.php
  18. +14 −2 inc/customizer/controls/layouts.php
  19. +6 −0 inc/customizer/fonts.php
  20. +17 −21 inc/customizer/layouts.php
  21. +4 −3 inc/helpers.php
  22. +1 −0 inc/hooks.php
  23. +1 −0 inc/template-tags.php
  24. +3 −2 inc/walker-nav-menu.php
  25. +0 −252 inc/woocommerce.php
  26. +1 −1 index.php
  27. +1 −1 page.php
  28. +1 −1 search.php
  29. +2 −8 sidebar-tertiary.php
  30. +1 −1 sidebar.php
  31. +1 −1 single.php
  32. +1 −0 templates/parts/credit.php
  33. +1 −0 templates/parts/footer-navigation.php
  34. +1 −0 templates/parts/footer-widgets.php
  35. +1 −0 templates/parts/hero.php
  36. +1 −0 templates/parts/loop/page-content.php
  37. +1 −0 templates/parts/loop/page-footer.php
  38. +1 −0 templates/parts/loop/post-content.php
  39. +1 −0 templates/parts/loop/post-excerpt.php
  40. +1 −0 templates/parts/loop/post-footer.php
  41. +1 −0 templates/parts/loop/post-meta.php
  42. +1 −0 templates/parts/loop/post-search-footer.php
  43. +1 −0 templates/parts/loop/post-thumbnail.php
  44. +1 −0 templates/parts/loop/post-title.php
  45. +2 −1 templates/parts/mobile-menu.php
  46. +1 −0 templates/parts/page-title.php
  47. +1 −0 templates/parts/primary-navigation.php
  48. +1 −0 templates/parts/site-info.php
  49. +1 −0 templates/parts/site-title.php
  50. +1 −0 templates/parts/social-navigation.php
View
@@ -6,7 +6,7 @@
* @link https://developer.wordpress.org/themes/template-files-section/partial-and-miscellaneous-template-files/#404-php
*
* @package Primer
- * @since 1.0.0
+ * @since 1.0.0
*/
get_header(); ?>
View
@@ -12,7 +12,7 @@
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package Primer
- * @since 1.0.0
+ * @since 1.0.0
*/
get_header(); ?>
View
@@ -8,7 +8,7 @@
* @link https://developer.wordpress.org/themes/template-files-section/partial-and-miscellaneous-template-files/#comments-php
*
* @package Primer
- * @since 1.0.0
+ * @since 1.0.0
*/
/*
View
@@ -5,7 +5,7 @@
* @link https://developer.wordpress.org/themes/template-files-section/partial-and-miscellaneous-template-files/#content-slug-php
*
* @package Primer
- * @since 1.0.0
+ * @since 1.0.0
*/
?>
View
@@ -5,7 +5,7 @@
* @link https://developer.wordpress.org/themes/template-files-section/partial-and-miscellaneous-template-files/#content-slug-php
*
* @package Primer
- * @since 1.0.0
+ * @since 1.0.0
*/
?>
View
@@ -5,7 +5,7 @@
* @link https://developer.wordpress.org/themes/template-files-section/partial-and-miscellaneous-template-files/#content-slug-php
*
* @package Primer
- * @since 1.0.0
+ * @since 1.0.0
*/
?>
View
@@ -5,7 +5,7 @@
* @link https://developer.wordpress.org/themes/template-files-section/partial-and-miscellaneous-template-files/#content-slug-php
*
* @package Primer
- * @since 1.0.0
+ * @since 1.0.0
*/
?>
View
@@ -7,7 +7,7 @@
* @link https://developer.wordpress.org/themes/template-files-section/partial-and-miscellaneous-template-files/#footer-php
*
* @package Primer
- * @since 1.0.0
+ * @since 1.0.0
*/
?>
View
@@ -45,7 +45,7 @@
*/
if ( version_compare( get_bloginfo( 'version' ), PRIMER_MIN_WP_VERSION, '<' ) ) {
- require_once get_template_directory() . '/inc/back-compat.php';
+ require_once get_template_directory() . '/inc/compat/wordpress.php';
}
@@ -78,25 +78,44 @@
require_once get_template_directory() . '/inc/hooks.php';
/**
- * Load Customizer class.
+ * Load Beaver Builder compatibility file.
*
* @since 1.0.0
*/
-require_once get_template_directory() . '/inc/customizer.php';
+if ( class_exists( 'FLBuilder' ) ) {
+
+ require_once get_template_directory() . '/inc/compat/beaver-builder.php';
+
+}
+
+/**
+ * Load Jetpack compatibility file.
+ *
+ * @since 1.0.0
+ */
+if ( class_exists( 'Jetpack' ) ) {
+
+ require_once get_template_directory() . '/inc/compat/jetpack.php';
+
+}
/**
* Load WooCommerce compatibility file.
*
* @since 1.0.0
*/
-require_once get_template_directory() . '/inc/woocommerce.php';
+if ( class_exists( 'WooCommerce' ) ) {
+
+ require_once get_template_directory() . '/inc/compat/woocommerce.php';
+
+}
/**
- * Load Jetpack compatibility file.
+ * Load Customizer class (must be required last).
*
* @since 1.0.0
*/
-require_once get_template_directory() . '/inc/jetpack.php';
+require_once get_template_directory() . '/inc/customizer.php';
/**
* Sets up theme defaults and registers support for various WordPress features.
View
@@ -5,7 +5,7 @@
* Displays all of the head element and everything up until the "site-content" div.
*
* @package Primer
- * @since 1.0.0
+ * @since 1.0.0
*/
?><!DOCTYPE html>
@@ -0,0 +1,109 @@
+<?php
+/**
+ * Beaver Builder compatibility.
+ *
+ * @package Primer
+ * @since 1.0.0
+ */
+
+/**
+ * Use full-width layout by default on Page Builder posts.
+ *
+ * @action add_post_meta
+ * @global Primer_Customizer_Layouts $primer_customizer_layouts
+ * @since 1.0.0
+ *
+ * @param int $post_id
+ * @param string $meta_key
+ * @param mixed $meta_value
+ */
+function primer_bb_layout( $post_id, $meta_key, $meta_value ) {
+
+ if ( '_fl_builder_draft' === $meta_key ) {
+
+ global $primer_customizer_layouts;
+
+ if ( isset( $primer_customizer_layouts->layouts['one-column-wide'] ) ) {
+
+ update_post_meta( $post_id, 'primer_layout', 'one-column-wide' );
+
+ }
+
+ }
+
+}
+add_action( 'add_post_meta', 'primer_bb_layout', 10, 3 );
+
+/**
+ * Add color scheme targets for Beaver Builder elements.
+ *
+ * @filter primer_colors
+ * @since 1.0.0
+ *
+ * @param array $colors
+ *
+ * @return array
+ */
+function primer_bb_colors( $colors ) {
+
+ $bb_colors = array(
+ 'primary_text_color' => array(
+ 'css' => array(
+ '.fl-callout-text,
+ .fl-rich-text' => array(
+ 'color' => '%1$s',
+ ),
+ ),
+ ),
+ 'button_color' => array(
+ 'css' => array(
+ 'a.fl-button,
+ a.fl-button:visited,
+ .content-area .fl-builder-content a.fl-button,
+ .content-area .fl-builder-content a.fl-button:visited' => array(
+ 'background-color' => '%1$s',
+ 'border-color' => '%1$s',
+ ),
+ ),
+ 'rgba_css' => array(
+ 'a.fl-button:hover,
+ a.fl-button:active,
+ a.fl-button:focus,
+ a.fl-button:visited:hover,
+ a.fl-button:visited:active,
+ a.fl-button:visited:focus,
+ .content-area .fl-builder-content a.fl-button:hover,
+ .content-area .fl-builder-content a.fl-button:active,
+ .content-area .fl-builder-content a.fl-button:focus,
+ .content-area .fl-builder-content a.fl-button:visited:hover,
+ .content-area .fl-builder-content a.fl-button:visited:active,
+ .content-area .fl-builder-content a.fl-button:visited:focus' => array(
+ 'background-color' => 'rgba(%1$s, 0.8)',
+ 'border-color' => 'rgba(%1$s, 0.8)',
+ ),
+ ),
+ ),
+ 'button_text_color' => array(
+ 'css' => array(
+ 'a.fl-button
+ a.fl-button:hover,
+ a.fl-button:active,
+ a.fl-button:focus,
+ a.fl-button:visited,
+ a.fl-button:visited:hover,
+ a.fl-button:visited:active,
+ a.fl-button:visited:focus,
+ .content-area .fl-builder-content a.fl-button,
+ .content-area .fl-builder-content a.fl-button *,
+ .content-area .fl-builder-content a.fl-button:visited,
+ .content-area .fl-builder-content a.fl-button:visited *' => array(
+ 'color' => '%1$s',
+ ),
+ ),
+ ),
+ );
+
+ return primer_array_replace_recursive( $colors, $bb_colors );
+
+}
+add_filter( 'primer_colors', 'primer_bb_colors' );
@@ -3,6 +3,7 @@
* Jetpack compatibility.
*
* @package Primer
+ * @since 1.0.0
*/
/**
Oops, something went wrong.

0 comments on commit bcd9a07

Please sign in to comment.