Skip to content
This repository has been archived by the owner on Mar 13, 2023. It is now read-only.

Commit

Permalink
Add primer_current_layout filter, compat dir, docblock fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
fjarrett-godaddy committed Sep 10, 2016
1 parent 83dd8b9 commit bcd9a07
Show file tree
Hide file tree
Showing 50 changed files with 512 additions and 336 deletions.
2 changes: 1 addition & 1 deletion 404.php
Expand Up @@ -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(); ?>
Expand Down
2 changes: 1 addition & 1 deletion archive.php
Expand Up @@ -12,7 +12,7 @@
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package Primer
* @since 1.0.0
* @since 1.0.0
*/
get_header(); ?>

Expand Down
2 changes: 1 addition & 1 deletion comments.php
Expand Up @@ -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
*/

/*
Expand Down
2 changes: 1 addition & 1 deletion content-none.php
Expand Up @@ -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
*/
?>

Expand Down
2 changes: 1 addition & 1 deletion content-page.php
Expand Up @@ -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
*/
?>

Expand Down
2 changes: 1 addition & 1 deletion content-search.php
Expand Up @@ -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
*/
?>

Expand Down
2 changes: 1 addition & 1 deletion content.php
Expand Up @@ -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
*/
?>

Expand Down
2 changes: 1 addition & 1 deletion footer.php
Expand Up @@ -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
*/
?>

Expand Down
31 changes: 25 additions & 6 deletions functions.php
Expand Up @@ -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';

}

Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion header.php
Expand Up @@ -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>
Expand Down
109 changes: 109 additions & 0 deletions inc/compat/beaver-builder.php
@@ -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' );
1 change: 1 addition & 0 deletions inc/jetpack.php → inc/compat/jetpack.php
Expand Up @@ -3,6 +3,7 @@
* Jetpack compatibility.
*
* @package Primer
* @since 1.0.0
*/

/**
Expand Down

0 comments on commit bcd9a07

Please sign in to comment.