Initial commit

This commit is contained in:
2018-09-13 20:49:49 +07:00
commit 32875f828d
82 changed files with 44319 additions and 0 deletions
+666
View File
@@ -0,0 +1,666 @@
<?php
/**
* Yeu Chay Bo Theme
*
* This file adds the color library used in the Yeu Chay Bo Theme.
*
* @package SEOThemes\CorporatePro
* @link https://thuanbui.me/themes/yeuchaybo
* @author Thuan Bui
* @copyright Copyright © 2018 Thuan Bui
* @license GPL-2.0+
*/
// If this file is called directly, abort..
if ( ! defined( 'WPINC' ) ) {
die;
}
/**
* Yeu Chay Bo Color Class
*
* A color utility that helps manipulate HEX colors.
*
* @author Arlo Carreon <http://arlocarreon.com>
* @link http://mexitek.github.io/phpColors/
* @license http://arlo.mit-license.org/
*/
class Corporate_Color {
/**
* HEX color.
*
* @var string
*/
private $_hex;
/**
* HSL color.
*
* @var string
*/
private $_hsl;
/**
* RGBA color.
*
* @var string
*/
private $_rgb;
/**
* Auto darkens/lightens by 10% for sexily-subtle gradients.
* Set this to FALSE to adjust automatic shade to be between given color
* and black (for darken) or white (for lighten)
*/
const DEFAULT_ADJUST = 10;
/**
* Instantiates the class with a HEX value
*
* @param string $hex Hex color.
*
* @throws Exception Bad color format.
*
* @return void
*/
function __construct( $hex ) {
// Strip # sign is present.
$color = str_replace( '#', '', $hex );
// Make sure it's 6 digits.
if ( strlen( $color ) === 3 ) {
$color = $color[0] . $color[0] . $color[1] . $color[1] . $color[2] . $color[2];
} elseif ( strlen( $color ) !== 6 ) {
throw new Exception( 'HEX color needs to be 6 or 3 digits long' );
}
$this->_hsl = self::hex_to_hsl( $color );
$this->_hex = $color;
$this->_rgb = self::hex_to_rgb( $color );
}
/*
|--------------------------------------------------------------------------
| Public interface
|--------------------------------------------------------------------------
*/
/**
* Given a HEX string returns a HSL array equivalent.
*
* @param string $color Color to convert.
*
* @return array HSL associative array
*/
public static function hex_to_hsl( $color ) {
// Sanity check.
$color = self::_check_hex( $color );
// Convert HEX to DEC.
$r = hexdec( $color[0] . $color[1] );
$g = hexdec( $color[2] . $color[3] );
$b = hexdec( $color[4] . $color[5] );
$hsl = array();
$var_r = ( $r / 255 );
$var_g = ( $g / 255 );
$var_b = ( $b / 255 );
$var_min = min( $var_r, $var_g, $var_b );
$var_max = max( $var_r, $var_g, $var_b );
$del_max = $var_max - $var_min;
$l = ( $var_max + $var_min ) / 2;
if ( 0 === $del_max ) {
$h = 0;
$s = 0;
} else {
if ( $l < 0.5 ) {
$s = $del_max / ( $var_max + $var_min );
} else {
$s = $del_max / ( 2 - $var_max - $var_min );
}
$del_r = ( ( ( $var_max - $var_r ) / 6 ) + ( $del_max / 2 ) ) / $del_max;
$del_g = ( ( ( $var_max - $var_g ) / 6 ) + ( $del_max / 2 ) ) / $del_max;
$del_b = ( ( ( $var_max - $var_b ) / 6 ) + ( $del_max / 2 ) ) / $del_max;
if ( $var_r === $var_max ) {
$h = $del_b - $del_g;
} elseif ( $var_g === $var_max ) {
$h = ( 1 / 3 ) + $del_r - $del_b;
} elseif ( $var_b === $var_max ) {
$h = ( 2 / 3 ) + $del_g - $del_r;
}
if ( $h < 0 ) {
$h ++;
}
if ( $h > 1 ) {
$h --;
}
}
$hsl['H'] = ( $h * 360 );
$hsl['S'] = $s;
$hsl['L'] = $l;
return $hsl;
}
/**
* Given a HSL associative array returns the equivalent HEX string
*
* @param array $hsl HSL color to check.
*
* @throws Exception Bad HSL Array.
*
* @return string HEX string
*/
public static function hsl_to_hex( $hsl = array() ) {
// Make sure it's HSL.
if ( empty( $hsl ) || ! isset( $hsl['H'] ) || ! isset( $hsl['S'] ) || ! isset( $hsl['L'] ) ) {
throw new Exception( 'Param was not an HSL array' );
}
list( $h, $s, $l ) = array( $hsl['H'] / 360, $hsl['S'], $hsl['L'] );
if ( 0 === $s ) {
$r = $l * 255;
$g = $l * 255;
$b = $l * 255;
} else {
if ( $l < 0.5 ) {
$var_2 = $l * ( 1 + $s );
} else {
$var_2 = ( $l + $s ) - ( $s * $l );
}
$var_1 = 2 * $l - $var_2;
$r = round( 255 * self::_huetorgb( $var_1, $var_2, $h + ( 1 / 3 ) ) );
$g = round( 255 * self::_huetorgb( $var_1, $var_2, $h ) );
$b = round( 255 * self::_huetorgb( $var_1, $var_2, $h - ( 1 / 3 ) ) );
}
// Convert to hex.
$r = dechex( $r );
$g = dechex( $g );
$b = dechex( $b );
// Make sure we get 2 digits for decimals.
$r = ( strlen( '' . $r ) === 1 ) ? '0' . $r : $r;
$g = ( strlen( '' . $g ) === 1 ) ? '0' . $g : $g;
$b = ( strlen( '' . $b ) === 1 ) ? '0' . $b : $b;
return $r . $g . $b;
}
/**
* Given a HEX string returns a RGB array equivalent.
*
* @param string $color Hex color to check.
*
* @return array RGB associative array
*/
public static function hex_to_rgb( $color ) {
// Sanity check.
$color = self::_check_hex( $color );
// Convert HEX to DEC.
$r = hexdec( $color[0] . $color[1] );
$g = hexdec( $color[2] . $color[3] );
$b = hexdec( $color[4] . $color[5] );
$rgb['R'] = $r;
$rgb['G'] = $g;
$rgb['B'] = $b;
return $rgb;
}
/**
* Given an RGB associative array returns the equivalent HEX string
*
* @param array $rgb RGB color to check.
*
* @return string RGB string
* @throws Exception Bad RGB Array.
*/
public static function rgb_to_hex( $rgb = array() ) {
// Make sure it's RGB.
if ( empty( $rgb ) || ! isset( $rgb['R'] ) || ! isset( $rgb['G'] ) || ! isset( $rgb['B'] ) ) {
throw new Exception( 'Param was not an RGB array' );
}
/*
* Convert RGB to HEX.
* @link https://github.com/mexitek/phpColors/issues/25#issuecomment-88354815.
*/
$hex[0] = str_pad( dechex( $rgb['R'] ), 2, '0', STR_PAD_LEFT );
$hex[1] = str_pad( dechex( $rgb['G'] ), 2, '0', STR_PAD_LEFT );
$hex[2] = str_pad( dechex( $rgb['B'] ), 2, '0', STR_PAD_LEFT );
return implode( '', $hex );
}
/**
* Given a HEX value, returns a darker color. If no desired amount provided,
* then the color halfway between given HEX and black will be returned.
*
* @param int $amount Amount to darken.
*
* @return string Darker HEX value
*/
public function darken( $amount = self::DEFAULT_ADJUST ) {
// Darken.
$darker_hsl = $this->_darken( $this->_hsl, $amount );
// Return as HEX.
return self::hsl_to_hex( $darker_hsl );
}
/**
* Given a HEX value, returns a lighter color. If no desired amount provided, then the color halfway between
* given HEX and white will be returned.
*
* @param int $amount Amount to lighten.
*
* @return string Lighter HEX value
*/
public function lighten( $amount = self::DEFAULT_ADJUST ) {
// Lighten.
$lighter_hsl = $this->_lighten( $this->_hsl, $amount );
// Return as HEX.
return self::hsl_to_hex( $lighter_hsl );
}
/**
* Given a HEX value, returns a mixed color. If no desired amount
* provided, then the color mixed by this ratio.
*
* @param string $hex2 Secondary HEX value to mix with.
* @param int $amount = -100..0..+100.
*
* @return string mixed HEX value
*/
public function mix( $hex2, $amount = 0 ) {
$rgb2 = self::hex_to_rgb( $hex2 );
$mixed = $this->_mix( $this->_rgb, $rgb2, $amount );
// Return as HEX.
return self::rgb_to_hex( $mixed );
}
/**
* Creates an array with two shades that can be used to make a gradient.
*
* @param int $amount Optional percentage amount you want your contrast color.
*
* @return array An array with a 'light' and 'dark' index
*/
public function make_gradient( $amount = self::DEFAULT_ADJUST ) {
// Decide which color needs to be made.
if ( $this->is_light() ) {
$light_color = $this->_hex;
$dark_color = $this->darken( $amount );
} else {
$light_color = $this->lighten( $amount );
$dark_color = $this->_hex;
}
// Return our gradient array.
return array(
'light' => $light_color,
'dark' => $dark_color,
);
}
/**
* Returns whether or not given color is considered "light"
*
* @param string|Boolean $color Color to check.
* @param int $lighter_than Light amount.
*
* @return boolean
*/
public function is_light( $color = false, $lighter_than = 130 ) {
// Get our color.
$color = ( $color ) ? $color : $this->_hex;
// Calculate straight from rbg.
$r = hexdec( $color[0] . $color[1] );
$g = hexdec( $color[2] . $color[3] );
$b = hexdec( $color[4] . $color[5] );
return ( ( $r * 299 + $g * 587 + $b * 114 ) / 1000 > $lighter_than );
}
/**
* Returns whether or not a given color is considered "dark"
*
* @param string|Boolean $color Color to check.
* @param int $darker_than Darkness.
*
* @return boolean
*/
public function is_dark( $color = false, $darker_than = 130 ) {
// Get our color.
$color = ( $color ) ? $color : $this->_hex;
// Calculate straight from rbg.
$r = hexdec( $color[0] . $color[1] );
$g = hexdec( $color[2] . $color[3] );
$b = hexdec( $color[4] . $color[5] );
return ( ( $r * 299 + $g * 587 + $b * 114 ) / 1000 <= $darker_than );
}
/**
* Returns the complimentary color.
*
* @return string Complementary hex color
*/
public function complementary() {
// Get our HSL.
$hsl = $this->_hsl;
// Adjust Hue 180 degrees.
$hsl['H'] += ( $hsl['H'] > 180 ) ? - 180 : 180;
// Return the new value in HEX.
return self::hsl_to_hex( $hsl );
}
/**
* Returns your color's HSL array
*/
public function get_hsl() {
return $this->_hsl;
}
/**
* Returns your original color
*/
public function get_hex() {
return $this->_hex;
}
/**
* Returns your color's RGB array
*/
public function get_rgb() {
return $this->_rgb;
}
/**
* Returns the cross browser CSS3 gradient
*
* @param int $amount Optional: percentage amount to light/darken the gradient.
* @param boolean $vintage_browsers Optional: include vendor prefixes for browsers that almost died out already.
* @param string $suffix Optional: suffix for every lines.
* @param string $prefix Optional: prefix for every lines.
*
* @link http://caniuse.com/css-gradients Resource for the browser support
*
* @return string CSS3 gradient for chrome, safari, firefox, opera and IE10
*/
public function get_css_gradient( $amount = self::DEFAULT_ADJUST, $vintage_browsers = false, $suffix = '', $prefix = '' ) {
// Get the recommended gradient.
$g = $this->make_gradient( $amount );
$css = '';
// Fallback/image non-cover color.
$css .= "{$prefix}background-color: #" . $this->_hex . ";{$suffix}";
// IE Browsers.
$css .= "{$prefix}filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#" . $g['light'] . "', endColorstr='#" . $g['dark'] . "');{$suffix}";
// Safari 4+, Chrome 1-9.
if ( $vintage_browsers ) {
$css .= "{$prefix}background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#" . $g['light'] . '), to(#' . $g['dark'] . "));{$suffix}";
}
// Safari 5.1+, Mobile Safari, Chrome 10+.
$css .= "{$prefix}background-image: -webkit-linear-gradient(top, #" . $g['light'] . ', #' . $g['dark'] . ");{$suffix}";
// Firefox 3.6+.
if ( $vintage_browsers ) {
$css .= "{$prefix}background-image: -moz-linear-gradient(top, #" . $g['light'] . ', #' . $g['dark'] . ");{$suffix}";
}
// Opera 11.10+.
if ( $vintage_browsers ) {
$css .= "{$prefix}background-image: -o-linear-gradient(top, #" . $g['light'] . ', #' . $g['dark'] . ");{$suffix}";
}
// Unprefixed version (standards): FF 16+, IE10+, Chrome 26+, Safari 7+, Opera 12.1+.
$css .= "{$prefix}background-image: linear-gradient(to bottom, #" . $g['light'] . ', #' . $g['dark'] . ");{$suffix}";
// Return our CSS.
return $css;
}
/*
|--------------------------------------------------------------------------
| Private functions.
|--------------------------------------------------------------------------
*/
/**
* Darkens a given HSL array
*
* @param array $hsl HSL color to check.
* @param int $amount Amount to darken.
*
* @return array $hsl
*/
private function _darken( $hsl, $amount = self::DEFAULT_ADJUST ) {
// Check if we were provided a number.
if ( $amount ) {
$hsl['L'] = ( $hsl['L'] * 100 ) - $amount;
$hsl['L'] = ( $hsl['L'] < 0 ) ? 0 : $hsl['L'] / 100;
} else {
// We need to find out how much to darken.
$hsl['L'] = $hsl['L'] / 2;
}
return $hsl;
}
/**
* Lightens a given HSL array
*
* @param array $hsl HSL color to check.
* @param int $amount Amount to darken.
*
* @return array $hsl
*/
private function _lighten( $hsl, $amount = self::DEFAULT_ADJUST ) {
// Check if we were provided a number.
if ( $amount ) {
$hsl['L'] = ( $hsl['L'] * 100 ) + $amount;
$hsl['L'] = ( $hsl['L'] > 100 ) ? 1 : $hsl['L'] / 100;
} else {
// We need to find out how much to lighten.
$hsl['L'] += ( 1 - $hsl['L'] ) / 2;
}
return $hsl;
}
/**
* Mix 2 rgb colors and return an rgb color
*
* @param array $rgb1 First RGBA color.
* @param array $rgb2 Second RGBA color.
* @param int $amount ranged -100..0..+100.
*
* @link http://phpxref.pagelines.com/nav.html?includes/class.colors.php.source.html
*
* @return array $rgb
*/
private function _mix( $rgb1, $rgb2, $amount = 0 ) {
$r1 = ( $amount + 100 ) / 100;
$r2 = 2 - $r1;
$rmix = ( ( $rgb1['R'] * $r1 ) + ( $rgb2['R'] * $r2 ) ) / 2;
$gmix = ( ( $rgb1['G'] * $r1 ) + ( $rgb2['G'] * $r2 ) ) / 2;
$bmix = ( ( $rgb1['B'] * $r1 ) + ( $rgb2['B'] * $r2 ) ) / 2;
return array(
'R' => $rmix,
'G' => $gmix,
'B' => $bmix,
);
}
/**
* Given a Hue, returns corresponding RGB value
*
* @param int $v1 First value.
* @param int $v2 Second value.
* @param int $vh Third value.
*
* @return int
*/
private static function _huetorgb( $v1, $v2, $vh ) {
if ( $vh < 0 ) {
$vh++;
}
if ( $vh > 1 ) {
$vh--;
}
if ( ( 6 * $vh ) < 1 ) {
return ( $v1 + ( $v2 - $v1 ) * 6 * $vh );
}
if ( ( 2 * $vh ) < 1 ) {
return $v2;
}
if ( ( 3 * $vh ) < 2 ) {
return ( $v1 + ( $v2 - $v1 ) * ( ( 2 / 3 ) - $vh ) * 6 );
}
return $v1;
}
/**
* You need to check if you were given a good hex string
*
* @param string $hex Hex color.
*
* @throws Exception "Bad color format".
*
* @return string Color
*/
private static function _check_hex( $hex ) {
// Strip # sign is present.
$color = str_replace( '#', '', $hex );
// Make sure it's 6 digits.
if ( strlen( $color ) === 3 ) {
$color = $color[0] . $color[0] . $color[1] . $color[1] . $color[2] . $color[2];
} elseif ( strlen( $color ) !== 6 ) {
throw new Exception( 'HEX color needs to be 6 or 3 digits long' );
}
return $color;
}
/**
* Converts object into its string representation
*
* @return string Color
*/
public function __toString() {
return '#' . $this->get_hex();
}
}
+370
View File
@@ -0,0 +1,370 @@
<?php
/**
* Yeu Chay Bo
*
* This file adds Customizer settings to the Yeu Chay Bo theme.
*
* @package SEOThemes\CorporatePro
* @link https://thuanbui.me/themes/yeuchaybo
* @author Thuan Bui
* @copyright Copyright © 2018 Thuan Bui
* @license GPL-2.0+
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
add_action( 'customize_register', 'corporate_customize_register', 20 );
/**
* Sets up the theme Customizer sections, controls, and settings.
*
* @access public
*
* @param object $wp_customize Global Customizer object.
*
* @return void
*/
function corporate_customize_register( $wp_customize ) {
// Globals.
global $wp_customize;
// Load RGBA Customizer control.
include_once CHILD_THEME_DIR . '/includes/rgba.php';
// Remove default colors, using custom instead.
$wp_customize->remove_control( 'background_color' );
$wp_customize->remove_control( 'header_textcolor' );
// Add logo size setting.
$wp_customize->add_setting(
'corporate_logo_size',
array(
'capability' => 'edit_theme_options',
'default' => corporate_logo_size(),
'sanitize_callback' => 'corporate_sanitize_number',
)
);
// Add logo size control.
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'corporate_logo_size',
array(
'label' => __( 'Logo Size', 'yeuchaybo' ),
'description' => __( 'Set the logo size in pixels. Default is ', 'yeuchaybo' ) . corporate_logo_size(),
'settings' => 'corporate_logo_size',
'section' => 'title_tagline',
'type' => 'number',
'priority' => 8,
)
)
);
// Add header settings.
$wp_customize->add_setting( 'corporate_sticky_header' );
// Add header controls.
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'corporate_sticky_header',
array(
'label' => __( 'Enable sticky header', 'yeuchaybo' ),
'settings' => 'corporate_sticky_header',
'section' => 'genesis_layout',
'type' => 'checkbox',
)
)
);
// Add gradient one settings.
$wp_customize->add_setting(
'corporate_gradient_one_color',
array(
'default' => corporate_gradient_one_color(),
'sanitize_callback' => 'sanitize_hex_color',
)
);
// Add gradient one controls.
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
'corporate_gradient_one_color',
array(
'label' => __( 'Gradient One Color', 'yeuchaybo' ),
'settings' => 'corporate_gradient_one_color',
'section' => 'colors',
)
)
);
// Add gradient two settings.
$wp_customize->add_setting(
'corporate_gradient_two_color',
array(
'default' => corporate_gradient_two_color(),
'sanitize_callback' => 'sanitize_hex_color',
)
);
// Add gradient two controls.
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
'corporate_gradient_two_color',
array(
'label' => __( 'Gradient Two Color', 'yeuchaybo' ),
'settings' => 'corporate_gradient_two_color',
'section' => 'colors',
)
)
);
// Add color setting.
$wp_customize->add_setting(
'corporate_overlay_color',
array(
'default' => corporate_overlay_color(),
'sanitize_callback' => 'corporate_sanitize_rgba',
)
);
// Add color control.
$wp_customize->add_control(
new RGBA_Customize_Control(
$wp_customize,
'corporate_overlay_color',
array(
'section' => 'colors',
'label' => __( 'Overlay Color', 'yeuchaybo' ),
'settings' => 'corporate_overlay_color',
'show_opacity' => true,
'palette' => true,
)
)
);
}
add_action( 'wp_enqueue_scripts', 'corporate_customizer_output', 100 );
/**
* Output Customizer styles.
*
* Checks the settings for the colors defined in the Customizer.
* If any of these value are set the appropriate CSS is output.
*
* @var array $corporate_colors Global theme colors.
*/
function corporate_customizer_output() {
// Theme colors.
$gradient_one = get_theme_mod( 'corporate_gradient_one_color', corporate_gradient_one_color() );
$gradient_two = get_theme_mod( 'corporate_gradient_two_color', corporate_gradient_two_color() );
$overlay = get_theme_mod( 'corporate_overlay_color', corporate_overlay_color() );
// Other customizer settings.
$logo_size = get_theme_mod( 'corporate_logo_size', corporate_logo_size() );
// Load color class.
include_once CHILD_THEME_DIR . '/includes/colors.php';
// Initialize accent color.
$accent = new Corporate_Color( $gradient_one );
$mix = '#' . $accent->mix( $gradient_two );
$shadow = corporate_hex_to_rgba( $mix, 0.3 );
// Ensure $css var is empty.
$css = '';
// Logo size CSS.
$css .= ( corporate_logo_size() !== $logo_size ) ? sprintf( '
.wp-custom-logo .title-area {
width: %1$spx;
}
', $logo_size ) : '';
// Overlay color CSS.
$css .= ( corporate_overlay_color() !== $overlay ) ? "
.hero-section:before,
.front-page-5 .image:before,
.front-page-9:before,
.archive.genesis-pro-portfolio .entry:before {
background: {$overlay};
}
" : '';
// Gradient color CSS.
$css .= ( corporate_gradient_one_color() !== $gradient_one || corporate_gradient_two_color() !== $gradient_two ) ? "
.button,
button,
input[type='button'],
input[type='reset'],
input[type='submit'],
.front-page-6,
.archive-pagination .active a,
.wp-block-button a {
background: {$gradient_one};
background: -moz-linear-gradient(-45deg, {$gradient_one} 0%, {$gradient_two} 100%);
background: -webkit-linear-gradient(-45deg, {$gradient_one} 0%,{$gradient_two} 100%);
background: linear-gradient(135deg, {$gradient_one} 0%,{$gradient_two} 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='{$gradient_one}', endColorstr='{$gradient_two}',GradientType=1 );
}
.button:hover,
.button:focus,
button:hover,
button:focus,
input[type='button']:hover,
input[type='button']:focus,
input[type='reset']:hover,
input[type='reset']:focus,
input[type='submit']:hover,
input[type='submit']:focus,
.wp-block-button a:hover,
.wp-block-button a:focus {
box-shadow: 0 0.5rem 2rem -0.5rem rgba({$shadow});
}
.button.outline,
button.outline,
input[type='button'].outline,
input[type='reset'].outline,
input[type='submit'].outline {
color: {$mix};
background: transparent;
box-shadow: inset 0 0 0 2px {$mix};
}
.button.outline:hover,
.button.outline:focus,
button.outline:hover,
button.outline:focus,
input[type='button'].outline:hover,
input[type='button'].outline:focus,
input[type='reset'].outline:hover,
input[type='reset'].outline:focus,
input[type='submit'].outline:hover,
input[type='submit'].outline:focus {
background-color: {$mix};
background: {$gradient_one};
background: -moz-linear-gradient(-45deg, {$gradient_one} 0%, {$gradient_two} 100%);
background: -webkit-linear-gradient(-45deg, {$gradient_one} 0%,{$gradient_two} 100%);
background: linear-gradient(135deg, {$gradient_one} 0%,{$gradient_two} 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='{$gradient_one}', endColorstr='{$gradient_two}',GradientType=1 );
}
a,
.sidebar a:hover,
.sidebar a:focus,
.site-footer a:hover,
.site-footer a:focus,
.entry-title a:hover,
.entry-title a:focus,
.menu-item a:hover,
.menu-item a:focus,
.menu-item.current-menu-item > a,
.site-footer .menu-item a:hover,
.site-footer .menu-item a:focus,
.site-footer .menu-item.current-menu-item > a,
.entry-content p a:not(.button):hover,
.entry-content p a:not(.button):focus,
.pricing-table strong,
div.gs-faq .gs-faq__question:hover,
div.gs-faq .gs-faq__question:focus {
color: {$mix};
}
input:focus,
select:focus,
textarea:focus {
border-color: {$mix};
}
.entry-content p a:not(.button) {
box-shadow: inset 0 -1.5px 0 {$mix};
}
" : '';
// WooCommerce only styles.
if ( corporate_is_woocommerce_page() ) {
$css .= ( corporate_gradient_one_color() !== $gradient_one || corporate_gradient_two_color() !== $gradient_two ) ? "
.woocommerce #respond input#submit,
.woocommerce a.button,
.woocommerce a.button.alt,
.woocommerce button.button,
.woocommerce button.button.alt,
.woocommerce input.button,
.woocommerce input.button.alt,
.woocommerce input.button[type=submit],
.woocommerce input.button[type=submit].alt {
background: {$gradient_one};
background: -moz-linear-gradient(-45deg, {$gradient_one} 0%, {$gradient_two} 100%);
background: -webkit-linear-gradient(-45deg, {$gradient_one} 0%,{$gradient_two} 100%);
background: linear-gradient(135deg, {$gradient_one} 0%,{$gradient_two} 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='{$gradient_one}', endColorstr='{$gradient_two}',GradientType=1 );
}
.woocommerce #respond input#submit:focus,
.woocommerce #respond input#submit:hover,
.woocommerce a.button.alt:focus,
.woocommerce a.button.alt:hover,
.woocommerce a.button:focus,
.woocommerce a.button:hover,
.woocommerce button.button.alt:focus,
.woocommerce button.button.alt:hover,
.woocommerce button.button:focus,
.woocommerce button.button:hover,
.woocommerce input.button.alt:focus,
.woocommerce input.button.alt:hover,
.woocommerce input.button:focus,
.woocommerce input.button:hover,
.woocommerce input.button[type=submit].alt:focus,
.woocommerce input.button[type=submit].alt:hover,
.woocommerce input.button[type=submit]:focus,
.woocommerce input.button[type=submit]:hover {
background: {$gradient_one};
background: -moz-linear-gradient(-45deg, {$gradient_one} 0%, {$gradient_two} 100%);
background: -webkit-linear-gradient(-45deg, {$gradient_one} 0%,{$gradient_two} 100%);
background: linear-gradient(135deg, {$gradient_one} 0%,{$gradient_two} 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='{$gradient_one}', endColorstr='{$gradient_two}',GradientType=1 );
box-shadow: 0 0.5rem 2rem -0.5rem rgba({$shadow});
}
.woocommerce div.product p.price,
.woocommerce div.product span.price,
div.gs-faq .gs-faq__question:hover,
div.gs-faq .gs-faq__question:focus {
color: {$mix};
}
" : '';
}
// Style handle is the name of the theme.
$handle = defined( 'CHILD_THEME_NAME' ) && CHILD_THEME_NAME ? sanitize_title_with_dashes( CHILD_THEME_NAME ) : 'child-theme';
// Output CSS if not empty.
if ( ! empty( $css ) ) {
// Add the inline styles, also minify CSS first.
wp_add_inline_style( $handle, corporate_minify_css( $css ) );
}
}
+353
View File
@@ -0,0 +1,353 @@
<?php
/**
* Yeu Chay Bo
*
* This file registers the required plugins for the Yeu Chay Bo theme.
*
* @package SEOThemes\CorporatePro
* @link https://thuanbui.me/themes/yeuchaybo
* @author Thuan Bui
* @copyright Copyright © 2018 Thuan Bui
* @license GPL-2.0+
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
add_filter( 'icon_widget_default_font', 'corporate_icon_widget_default_font' );
/**
* Set the default icon widget font.
*
* @since 1.0.0
*
* @return string
*/
function corporate_icon_widget_default_font() {
return 'streamline';
}
add_filter( 'icon_widget_default_color', 'corporate_icon_widget_default_color' );
/**
* Set the default icon widget font.
*
* @since 1.0.0
*
* @return string
*/
function corporate_icon_widget_default_color() {
return corporate_gradient_two_color();
}
add_filter( 'icon_widget_default_size', 'corporate_icon_widget_default_size' );
/**
* Set the default icon widget font.
*
* @since 1.0.0
*
* @return string
*/
function corporate_icon_widget_default_size() {
return '2x';
}
add_filter( 'icon_widget_default_align', 'corporate_icon_widget_default_align' );
/**
* Set the default icon widget font.
*
* @since 1.0.0
*
* @return string
*/
function corporate_icon_widget_default_align() {
return 'left';
}
add_filter( 'seo_slider_default_overlay', 'corporate_default_slider_overlay' );
/**
* Set the default slider overlay color.
*
* @since 1.0.0
*
* @return string
*/
function corporate_default_slider_overlay() {
return corporate_overlay_color();
}
add_filter( 'genesis_theme_settings_defaults', 'corporate_theme_defaults' );
/**
* Update theme settings upon reset.
*
* @since 1.0.0
*
* @param array $defaults Default theme settings.
*
* @return array Custom theme settings.
*/
function corporate_theme_defaults( $defaults ) {
$defaults['blog_cat_num'] = 6;
$defaults['content_archive'] = 'excerpt';
$defaults['content_archive_limit'] = 150;
$defaults['content_archive_thumbnail'] = 1;
$defaults['image_alignment'] = 'alignnone';
$defaults['posts_nav'] = 'numeric';
$defaults['image_size'] = 'portfolio';
$defaults['site_layout'] = 'full-width-content';
return $defaults;
}
add_action( 'after_switch_theme', 'corporate_theme_setting_defaults' );
/**
* Update theme settings upon activation.
*
* @since 1.0.0
*
* @return void
*/
function corporate_theme_setting_defaults() {
if ( function_exists( 'genesis_update_settings' ) ) {
genesis_update_settings( array(
'blog_cat_num' => 6,
'content_archive' => 'excerpt',
'content_archive_limit' => 150,
'content_archive_thumbnail' => 1,
'image_alignment' => 'alignnone',
'image_size' => 'portfolio',
'posts_nav' => 'numeric',
'site_layout' => 'full-width-content',
) );
}
update_option( 'posts_per_page', 9 );
}
add_filter( 'simple_social_default_styles', 'corporate_social_default_styles' );
/**
* Set the Simple Social Icon defaults.
*
* @since 1.0.0
*
* @param array $defaults Default Simple Social Icons settings.
*
* @return array Custom settings.
*/
function corporate_social_default_styles( $defaults ) {
$args = array(
'alignment' => 'alignleft',
'background_color' => '#fdfeff',
'background_color_hover' => '#fdfeff',
'border_radius' => 0,
'border_color' => '#fdfeff',
'border_color_hover' => '#fdfeff',
'border_width' => 0,
'icon_color' => '#c6cace',
'icon_color_hover' => corporate_gradient_two_color(),
'size' => 40,
'new_window' => 1,
'facebook' => '#',
'gplus' => '#',
'instagram' => '#',
'dribbble' => '#',
'twitter' => '#',
'youtube' => '#',
);
$args = wp_parse_args( $args, $defaults );
return $args;
}
add_filter( 'gsw_settings_defaults', 'corporate_testimonial_defaults' );
/**
* Filter the default Genesis Testimonial Slider settings.
*
* @since 1.0.0
*
* @param array $defaults Default plugin settings.
*
* @return array
*/
function corporate_testimonial_defaults( $defaults ) {
$defaults = array(
'gts_autoplay' => 'yes',
'gts_column' => 'three',
'gts_controls' => 'yes',
'gts_loop' => 'yes',
'gts_effect' => 'slide',
'gts_pause' => 'yes',
'gts_speed' => '6000',
);
return $defaults;
}
add_filter( 'genesis_widget_column_classes', 'corporate_widget_columns' );
/**
* Add additional column class to plugin.
*
* @since 1.0.0
*
* @param array $column_classes Array of column classes.
*
* @return array Modified column classes.
*/
function corporate_widget_columns( $column_classes ) {
$column_classes[] = 'full-width';
return $column_classes;
}
add_action( 'after_switch_theme', 'corporate_excerpt_metabox' );
/**
* Display excerpt metabox by default.
*
* The excerpt metabox is hidden by default on the page edit screen which
* can cause some confusion for users when they want to edit or remove
* the excerpt. To make life easier, we want to display the metabox
* by default and that's what this function does. It is only run
* after switching theme so the current user's screen options
* are updated which allows them to hide the metabox again.
*
* @since 1.0.0
*
* @return void
*/
function corporate_excerpt_metabox() {
// Get current user ID.
$user_id = get_current_user_id();
// Create array of post types to include.
$post_types = array(
'page',
'post',
'portfolio',
);
// Loop through each post type and update user meta.
foreach ( $post_types as $post_type ) {
// Create variables.
$meta_key = 'metaboxhidden_' . $post_type;
$prev_value = get_user_meta( $user_id, $meta_key, true );
// Check if value is an array.
if ( ! is_array( $prev_value ) ) {
$prev_value = array(
'genesis_inpost_seo_box',
'postcustom',
'postexcerpt',
'commentstatusdiv',
'commentsdiv',
'slugdiv',
'authordiv',
'genesis_inpost_scripts_box',
);
}
// Empty array to prevent errors.
$meta_value = array();
// Remove excerpt from array.
$meta_value = array_diff( $prev_value, array( 'postexcerpt' ) );
// Update user meta with new value.
update_user_meta( $user_id, $meta_key, $meta_value, $prev_value );
}
}
add_filter( 'pt-ocdi/import_files', 'corporate_import_files' );
/**
* One click demo import settings.
*
* @since 1.0.0
*
* @return array
*/
function corporate_import_files() {
return array(
array(
'local_import_file' => CHILD_THEME_DIR . '/sample.xml',
'local_import_widget_file' => CHILD_THEME_DIR . '/widgets.wie',
'local_import_customizer_file' => CHILD_THEME_DIR . '/customizer.dat',
'import_file_name' => 'Demo Import',
'categories' => false,
'local_import_redux' => false,
'import_preview_image_url' => false,
'import_notice' => false,
),
);
}
add_filter( 'pt-ocdi/after_all_import_execution', 'corporate_after_demo_import', 999 );
/**
* Set default pages after demo import.
*
* Automatically creates and sets the Static Front Page and the Page for Posts
* upon theme activation, only if these pages don't already exist and only
* if the site does not already display a static page on the homepage.
*
* @since 1.0.0
*
* @return void
*/
function corporate_after_demo_import() {
// Assign menus to their locations.
$menu = get_term_by( 'name', 'Header Menu', 'nav_menu' );
set_theme_mod( 'nav_menu_locations', array(
'primary' => $menu->term_id,
) );
// Assign front page and posts page (blog page).
$home = get_page_by_title( 'Home' );
$news = get_page_by_title( 'News' );
update_option( 'show_on_front', 'page' );
update_option( 'page_on_front', $home->ID );
update_option( 'page_for_posts', $news->ID );
// Set the WooCommerce shop page.
$shop = get_page_by_title( 'Shop' );
update_option( 'woocommerce_shop_page_id', $shop->ID );
// Trash "Hello World" post.
wp_delete_post( 1 );
}
+587
View File
@@ -0,0 +1,587 @@
<?php
/**
* Yeu Chay Bo
*
* This file adds general theme functions to the Yeu Chay Bo Theme.
*
* @package SEOThemes\CorporatePro
* @link https://thuanbui.me/themes/yeuchaybo
* @author Thuan Bui
* @copyright Copyright © 2018 Thuan Bui
* @license GPL-2.0+
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
add_filter( 'body_class', 'corporate_body_classes' );
/**
* Add additional classes to the body element.
*
* Adds some extra classes to the body element which help with styling the
* same elements differently depending on which settings the user has
* chosen from either the Customizer, Widget Areas or Navigation.
*
* @since 1.0.0
*
* @param array $classes Body classes.
*
* @return array
*/
function corporate_body_classes( $classes ) {
if ( true === get_theme_mod( 'corporate_sticky_header', false ) ) {
$classes[] = 'sticky-header';
}
if ( is_active_sidebar( 'before-header' ) ) {
$classes[] = 'has-before-header';
}
if ( has_nav_menu( 'secondary' ) ) {
$classes[] = 'has-nav-secondary';
}
if ( is_page_template( 'page_blog.php' ) ) {
$classes[] = 'blog';
$classes = array_diff( $classes, [ 'page' ] );
}
if ( corporate_sidebar_has_widget( 'front-page-1', 'seo_slider' ) ) {
$classes[] = 'has-hero-slider';
}
$classes[] = 'no-js';
return $classes;
}
add_action( 'genesis_before', 'corporate_js_nojs_script', 1 );
/**
* Echo out the script that changes 'no-js' class to 'js'.
*
* Adds a script on the genesis_before hook which immediately changes the
* class to js if JavaScript is enabled. This is how WP does things on
* the back end, to allow different styles for the same elements
* depending if JavaScript is active or not.
*
* Outputting the script immediately also reduces a flash of incorrectly
* styled content, as the page does not load with no-js styles, then
* switch to js once everything has finished loading.
*
* @since 1.0.0
*
* @return void
*/
function corporate_js_nojs_script() {
?>
<script>
//<![CDATA[
(function(){
var c = document.body.classList;
c.remove( 'no-js' );
c.add( 'js' );
})();
//]]>
</script>
<?php
}
add_filter( 'genesis_attr_title-area', 'corporate_title_area_schema' );
/**
* Add schema microdata to title-area.
*
* By default, Genesis applies no schema microdata to the title area element.
* Since this is a business theme, the site title is usually the business
* name, so we want to mark up this section with the relevant schema.
*
* @since 1.0.0
*
* @param array $attr Array of attributes.
*
* @return array
*/
function corporate_title_area_schema( $attr ) {
$attr['itemscope'] = 'itemscope';
$attr['itemtype'] = 'http://schema.org/Organization';
return $attr;
}
add_filter( 'genesis_attr_site-title', 'corporate_site_title_schema' );
/**
* Correct site title schema.
*
* Genesis adds the headline itemprop to the site title by default. Since we
* already have a headline (page title) we can remove this and replace it
* with an itemprop of name which is inside of the Organization scope.
*
* @since 1.0.0
*
* @param array $attr Array of attributes.
*
* @return array
*/
function corporate_site_title_schema( $attr ) {
$attr['itemprop'] = 'name';
return $attr;
}
add_action( 'wp_head', 'corporate_remove_ssi_inline_styles', 1 );
/**
* Remove Simple Social Icons inline CSS.
*
* The default Simple Social Icons styles are no longer needed because we are
* generating custom CSS instead. Removing this means we don't need to use
* !important rules in the multiple instance workaround function below.
*
* @since 1.0.0
*
* @return void
*/
function corporate_remove_ssi_inline_styles() {
if ( class_exists( 'Simple_Social_Icons_Widget' ) ) {
global $wp_widget_factory;
remove_action( 'wp_head', array( $wp_widget_factory->widgets['Simple_Social_Icons_Widget'], 'css' ) );
}
}
add_action( 'wp_head', 'corporate_simple_social_icons_css' );
/**
* Simple Social Icons multiple instances workaround.
*
* By default, Simple Social Icons only allows you to create one style for your
* icons, even if you have multiple on the same page. This function allows us
* to have different styles for each widget that is output on the frontend.
*
* @since 1.0.0
*
* @return void
*/
function corporate_simple_social_icons_css() {
if ( ! class_exists( 'Simple_Social_Icons_Widget' ) ) {
return;
}
$obj = new Simple_Social_Icons_Widget();
// Get widget settings.
$all_instances = $obj->get_settings();
// Loop through instances.
foreach ( $all_instances as $key => $options ) :
$instance = wp_parse_args( $all_instances[ $key ] );
$font_size = round( (int) $instance['size'] / 2 );
$icon_padding = round( (int) $font_size / 2 );
// CSS to output.
$css = '#' . $obj->id_base . '-' . $key . ' ul li a,
#' . $obj->id_base . '-' . $key . ' ul li a:hover {
background-color: ' . $instance['background_color'] . ';
border-radius: ' . $instance['border_radius'] . 'px;
color: ' . $instance['icon_color'] . ';
border: ' . $instance['border_width'] . 'px ' . $instance['border_color'] . ' solid;
font-size: ' . $font_size . 'px;
padding: ' . $icon_padding . 'px;
}
#' . $obj->id_base . '-' . $key . ' ul li a:hover,
#' . $obj->id_base . '-' . $key . ' ul li a:focus {
background-color: ' . $instance['background_color_hover'] . ';
border-color: ' . $instance['border_color_hover'] . ';
color: ' . $instance['icon_color_hover'] . ';
}';
// Minify.
$css = corporate_minify_css( $css );
// Output.
printf( '<style type="text/css" media="screen">%s</style>', $css );
endforeach;
}
add_action( 'init', 'corporate_structural_wrap_hooks' );
/**
* Add hooks before and after Genesis structural wraps.
*
* This is a clever workaround that allows us to insert HTML between a container
* and its immediate descendant .wrap element. These hooks are used to display
* the Before Header widget area, the Secondary Nav and the Footer Widgets.
*
* @since 1.0.0
*
* @author Tim Jensen
* @link https://timjensen.us/add-hooks-before-genesis-structural-wraps
*
* @return void
*/
function corporate_structural_wrap_hooks() {
$wraps = get_theme_support( 'genesis-structural-wraps' );
foreach ( $wraps[0] as $context ) {
/**
* Inserts an action hook before the opening div and after the closing div
* for each of the structural wraps.
*
* @param string $output HTML for opening or closing the structural wrap.
* @param string $original Either 'open' or 'close'.
*
* @return string
*/
add_filter( "genesis_structural_wrap-{$context}", function ( $output, $original ) use ( $context ) {
$position = ( 'open' === $original ) ? 'before' : 'after';
ob_start();
do_action( "genesis_{$position}_{$context}_wrap" );
if ( 'open' === $original ) {
return ob_get_clean() . $output;
} else {
return $output . ob_get_clean();
}
}, 10, 2 );
}
}
add_filter( 'http_request_args', 'corporate_dont_update_theme', 5, 2 );
/**
* Prevent automatic theme updates.
*
* Because WordPress (the software) doesnt know whether a theme or plugin is
* listed in the WordPress.org repositories, it has to check them all, and
* let the repository sort it out. If there is a theme in the repo with
* the same name this prevents WP from prompting an automatic update.
*
* @since 1.0.0
*
* @link https://markjaquith.wordpress.com/2009/12/14/excluding-your-plugin-or-theme-from-update-checks/
* @param array $request Request arguments.
* @param string $url Request url.
*
* @return array request arguments
*/
function corporate_dont_update_theme( $request, $url ) {
// Not a theme update request. Bail immediately.
if ( 0 !== strpos( $url, 'http://api.wordpress.org/themes/update-check' ) ) {
return $request;
}
$themes = unserialize( $request['body']['themes'] );
unset( $themes[ get_option( 'template' ) ] );
unset( $themes[ get_option( 'stylesheet' ) ] );
$request['body']['themes'] = serialize( $themes );
return $request;
}
add_filter( 'agm_custom_styles', 'corporate_map_styles' );
/**
* Custom Google map style (Ultra Light).
*
* Adds a custom Google map style to the Google Map plugin used in the theme demo.
* The JSON file used in this function can be found in the top level directory
* of the theme. More information can be found by following the links below.
*
* @since 1.0.0
*
* @link https://github.com/ankurk91/wp-google-map/wiki/How-to-add-your-own-styles
* @link https://snazzymaps.com/style/85413/cartagena
* @param array $json Array of JSON data.
*
* @return array
*/
function corporate_map_styles( $json ) {
array_push( $json, array(
'id' => '123456789',
'name' => 'Ultra Light',
'style' => json_decode( file_get_contents( CHILD_THEME_DIR . '/map.json' ), true ),
) );
return $json;
}
add_filter( 'genesis_markup_title-area_close', 'corporate_after_title_area', 10, 2 );
/**
* Appends HTML to the closing markup for .title-area.
*
* Adding something between the title + description and widget area used to require
* re-building genesis_do_header(). However, since the title-area closing markup
* now goes through genesis_markup(), it means we now have some extra filters
* to play with. This function makes use of this and adds in an extra hook
* after the title-area used for displaying the primary navigation menu.
*
* @since 1.0.0
*
* @param string $close_html HTML tag being processed by the API.
* @param array $args Array with markup arguments.
*
* @return string
*/
function corporate_after_title_area( $close_html, $args ) {
if ( $close_html ) {
ob_start();
do_action( 'genesis_after_title_area' );
$close_html = $close_html . ob_get_clean();
}
return $close_html;
}
//add_filter( 'display_posts_shortcode_output', 'corporate_remove_listing_link', 20 );
/**
* Remove redundant link from listing item.
*
* By default, the Display Posts Shortcode outputs Adjacent links go to the same URL.
* When adjacent links go to the same location (such as a linked product image and
* an adjacent linked product name that go to the same product page) this results
* in additional navigation and repetition for keyboard and screen reader users.
* To meet 508 compliance and WCAG, we need to remove these redundant links.
*
* @since 1.0.0
*
* @link https://webaim.org/standards/wcag/checklist#sc2.4.4
* @param string $output Display posts output.
*
* @return string
*/
function corporate_remove_listing_link( $output ) {
$output = str_replace( '<a class="title"', '<h3 class="title"', $output );
$output = str_replace( '</a></li>', '</h3></li>', $output );
return $output;
}
add_action( 'genesis_entry_header', 'corporate_reposition_post_meta', 0 );
/**
* Reposition post info and remove excerpts on archives.
*
* Small customization to reposition the post info and remove the excerpt links
* on all archive pages including search results, blog page, categories etc.
*
* @since 1.0.0
*
* @return void
*/
function corporate_reposition_post_meta() {
if ( is_archive() || is_home() || is_search() || is_post_type_archive() ) {
// Reposition post meta.
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
add_action( 'genesis_entry_header', 'genesis_post_info', 1 );
// Remove read more link on archives.
add_filter( 'get_the_content_more_link', '__return_empty_string' );
}
}
add_filter( 'genesis_post_info', 'corporate_post_info_date' );
/**
* Change the default post info on archives.
*
* Replaces the default post info (author, comments, edit link) with just the
* date of the post, which is then repositioned above the entry title with
* the corporate_reposition_post_meta() function above on archive pages.
*
* @since 1.0.0
*
* @param string $post_info The default post information.
*
* @return string
*/
function corporate_post_info_date( $post_info ) {
if ( is_archive() || is_home() || is_search() || is_post_type_archive() ) {
$post_info = '[post_date]';
}
return $post_info;
}
add_filter( 'genesis_post_meta', 'corporate_post_meta_filter' );
/**
* Customize the entry meta in the entry footer.
*
* This function filters the genesis post meta to display SVG icons before the
* post categories and post tags on archive pages including the search page,
* blog, category and tag pages. SVG images are included with the theme.
*
* @since 1.0.0
*
* @param string $post_meta Default post meta.
*
* @return string
*/
function corporate_post_meta_filter( $post_meta ) {
if ( is_archive() || is_home() || is_search() || ! is_post_type_archive() ) {
$cat_alt = apply_filters( 'corporate_cat_alt', __( 'Category icon', 'yeuchaybo' ) );
$tag_alt = apply_filters( 'corporate_tag_alt', __( 'Tag icon', 'yeuchaybo' ) );
$cat_img = '<img width=\'20\' height=\'20\' alt=\'' . $cat_alt . '\' src=\'' . CHILD_THEME_URI . '/assets/images/cats.svg\'>';
$tag_img = '<img width=\'20\' height=\'20\' alt=\'' . $tag_alt . '\' src=\'' . CHILD_THEME_URI . '/assets/images/tags.svg\'>';
$post_meta = '[post_categories before="' . $cat_img . '" sep=",&nbsp;"] [post_tags before="' . $tag_img . '" sep=",&nbsp;"]';
}
return $post_meta;
}
add_filter( 'genesis_attr_site-container', 'corporate_primary_nav_id' );
/**
* Add ID attribute to site-container.
*
* This adds an ID attribute to the site-container by filtering the element
* attributes so that the "Return to Top" link has something to link to.
*
* @since 1.0.0
*
* @param array $atts Navigation attributes.
*
* @return array
*/
function corporate_primary_nav_id( $atts ) {
$atts['id'] = 'top';
return $atts;
}
add_shortcode( 'footer_backtotop', 'corporate_footer_backtotop_shortcode' );
/**
* Produces the "Return to Top" link.
*
* Supported shortcode attributes are:
* - after (output after link, default is empty string),
* - before (output before link, default is empty string),
* - href (link url, default is fragment identifier '#wrap'),
* - nofollow (boolean for whether to include rel="nofollow", default is true),
* - text (Link text, default is 'Return to top of page').
*
* Output passes through `corporate_footer_backtotop_shortcode` filter before returning.
*
* @since 1.0.0
*
* @param array|string $atts Shortcode attributes. Empty string if no attributes.
*
* @return string Output for `footer_backtotop` shortcode.
*/
function corporate_footer_backtotop_shortcode( $atts ) {
$defaults = array(
'after' => '',
'before' => '',
'href' => '#top',
'nofollow' => true,
'text' => __( 'Return to top', 'genesis' ),
);
$atts = shortcode_atts( $defaults, $atts, 'footer_backtotop' );
$nofollow = $atts['nofollow'] ? 'rel="nofollow"' : '';
$output = sprintf( '%s<a href="%s" %s>%s</a>%s', $atts['before'], esc_url( $atts['href'] ), $nofollow, $atts['text'], $atts['after'] );
return apply_filters( 'corporate_footer_backtotop_shortcode', $output, $atts );
}
add_filter( 'genesis_site_layout', 'corporate_search_and_404_page_layouts' );
/**
* Gets a custom page layout for the search results page.
*
* @since 1.0.0
*
* @return string
*/
function corporate_search_and_404_page_layouts() {
if ( is_search() ) {
$page = get_page_by_path( 'search' );
$field = genesis_get_custom_field( '_genesis_layout', $page->ID );
$layout = $field ? $field : genesis_get_option( 'site_layout' );
return $layout;
}
if ( is_404() ) {
$page = get_page_by_path( 'error-404' );
$field = genesis_get_custom_field( '_genesis_layout', $page->ID );
$layout = $field ? $field : genesis_get_option( 'site_layout' );
return $layout;
}
}
+349
View File
@@ -0,0 +1,349 @@
<?php
/**
* Yeu Chay Bo
*
* This file adds helper functions used in the Yeu Chay Bo Theme.
*
* @package SEOThemes\CorporatePro
* @link https://thuanbui.me/themes/yeuchaybo
* @author Thuan Bui
* @copyright Copyright © 2018 Thuan Bui
* @license GPL-2.0+
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
/**
* Returns the default logo size in pixels.
*
* @since 1.0.0
*
* @return string Hex value.
*/
function corporate_logo_size() {
return 150;
}
/**
* Returns the default gradient one color.
*
* @since 1.0.0
*
* @return string Hex value.
*/
function corporate_gradient_one_color() {
return '#00c6ff';
}
/**
* Returns the default gradient two color.
*
* @since 1.0.0
*
* @return string Hex value.
*/
function corporate_gradient_two_color() {
return '#0072ff';
}
/**
* Returns the default overlay color.
*
* @since 1.0.0
*
* @return string Hex value.
*/
function corporate_overlay_color() {
return 'rgba(42,49,57,0.5)';
}
/**
* Custom header image callback.
*
* Loads custom header or featured image depending on what is set on a per
* page basis. If a featured image is set for a page, it will override
* the default header image. It also gets the image for custom post
* types by looking for a page with the same slug as the CPT e.g
* the Portfolio CPT archive will pull the featured image from
* a page with the slug of 'portfolio', if the page exists.
*
* @since 1.0.0
*
* @return string
*/
function corporate_custom_header() {
$id = '';
// Get the current page ID.
if ( class_exists( 'WooCommerce' ) && is_shop() ) {
$id = wc_get_page_id( 'shop' );
} elseif ( is_post_type_archive() ) {
$id = get_page_by_path( get_query_var( 'post_type' ) );
} elseif ( is_front_page() ) {
$id = get_option( 'page_on_front' );
} elseif ( is_home() ) {
$id = get_option( 'page_for_posts' );
} elseif ( is_search() ) {
$id = get_page_by_path( 'search' );
} elseif ( is_404() ) {
$id = get_page_by_path( 'error-404' );
} elseif ( is_singular() ) {
$id = get_the_id();
}
$url = get_the_post_thumbnail_url( $id, 'slider' );
if ( ! $url ) {
$url = get_header_image();
}
return printf( '<style type="text/css">.hero-section{background-image: url(%s);}</style>' . "\n", esc_url( $url ) );
}
/**
* Sanitize number values.
*
* Ensure number is an absolute integer (whole number, zero or greater). If
* input is an absolute integer, return it. Otherwise, return default.
*
* @since 2.0.0
*
* @param string $number The rgba color to sanitize.
* @param string $setting Sanitized value.
*
* @return string
*/
function corporate_sanitize_number( $number, $setting ) {
$number = absint( $number );
return ( $number ? $number : $setting->default );
}
/**
* Sanitize RGBA values.
*
* If string does not start with 'rgba', then treat as hex then
* sanitize the hex color and finally convert hex to rgba.
*
* @since 1.0.0
*
* @param string $color The rgba color to sanitize.
*
* @return string
*/
function corporate_sanitize_rgba( $color ) {
// Return invisible if empty.
if ( empty( $color ) || is_array( $color ) ) {
return 'rgba(0,0,0,0)';
}
// Return sanitized hex if not rgba value.
if ( false === strpos( $color, 'rgba' ) ) {
return sanitize_hex_color( $color );
}
// Finally, sanitize and return rgba.
$color = str_replace( ' ', '', $color );
sscanf( $color, 'rgba(%d,%d,%d,%f)', $red, $green, $blue, $alpha );
return 'rgba(' . $red . ',' . $green . ',' . $blue . ',' . $alpha . ')';
}
/**
* Minify CSS helper function.
*
* @since 1.0.0
*
* @author Gary Jones
* @link https://github.com/GaryJones/Simple-PHP-CSS-Minification
* @param string $css The CSS to minify.
*
* @return string
*/
function corporate_minify_css( $css ) {
// Normalize whitespace.
$css = preg_replace( '/\s+/', ' ', $css );
// Remove spaces before and after comment.
$css = preg_replace( '/(\s+)(\/\*(.*?)\*\/)(\s+)/', '$2', $css );
// Remove comment blocks, everything between /* and */, unless preserved with /*! ... */ or /** ... */.
$css = preg_replace( '~/\*(?![\!|\*])(.*?)\*/~', '', $css );
// Remove ; before }.
$css = preg_replace( '/;(?=\s*})/', '', $css );
// Remove space after , : ; { } */ >.
$css = preg_replace( '/(,|:|;|\{|}|\*\/|>) /', '$1', $css );
// Remove space before , ; { } ( ) >.
$css = preg_replace( '/ (,|;|\{|}|\(|\)|>)/', '$1', $css );
// Strips leading 0 on decimal values (converts 0.5px into .5px).
$css = preg_replace( '/(:| )0\.([0-9]+)(%|em|ex|px|in|cm|mm|pt|pc)/i', '${1}.${2}${3}', $css );
// Strips units if value is 0 (converts 0px to 0).
$css = preg_replace( '/(:| )(\.?)0(%|em|ex|px|in|cm|mm|pt|pc)/i', '${1}0', $css );
// Converts all zeros value into short-hand.
$css = preg_replace( '/0 0 0 0/', '0', $css );
// Shorten 6-character hex color codes to 3-character where possible.
$css = preg_replace( '/#([a-f0-9])\\1([a-f0-9])\\2([a-f0-9])\\3/i', '#\1\2\3', $css );
return trim( $css );
}
/**
* Helper function to check if we're on a WooCommerce page.
*
* This function is used to check whether or not to output the
* WooCommerce CSS in the corporate_scripts_styles function.
* Since it's a relatively large file, we don't want it to
* load on unnecessary pages where it's not required.
*
* @since 1.0.0
*
* @link https://docs.woocommerce.com/document/conditional-tags/.
*
* @return bool
*/
function corporate_is_woocommerce_page() {
if ( ! class_exists( 'WooCommerce' ) ) {
return false;
}
if ( is_woocommerce() || is_shop() || is_product_category() || is_product_tag() || is_product() || is_cart() || is_checkout() || is_account_page() ) {
return true;
} else {
return false;
}
}
/**
* Convert hex to rgba value.
*
* This function takes a hex code (e.g. #eeeeee) and returns array of RGBA values.
* Used in the corporate_customizer_output function to handle transparency.
*
* @since 1.0.0
*
* @param string $colour Hex color to convert.
* @param int $opacity Opacity amount.
*
* @return string
*/
function corporate_hex_to_rgba( $colour, $opacity ) {
if ( '#' === $colour[0] ) {
$colour = substr( $colour, 1 );
}
if ( strlen( $colour ) === 6 ) {
list( $r, $g, $b ) = array( $colour[0] . $colour[1], $colour[2] . $colour[3], $colour[4] . $colour[5] );
} elseif ( strlen( $colour ) === 3 ) {
list( $r, $g, $b ) = array( $colour[0] . $colour[0], $colour[1] . $colour[1], $colour[2] . $colour[2] );
} else {
return false;
}
$r = hexdec( $r );
$g = hexdec( $g );
$b = hexdec( $b );
$rgb = array(
'red' => $r,
'green' => $g,
'blue' => $b,
);
$rgba = implode( $rgb, ',' ) . ',' . $opacity;
return $rgba;
}
/**
* Check if Front Page 1 contains slider widget.
*
* @since 1.0.1
*
* @uses $sidebars_widgets
*
* @param string $sidebar Name of sidebar, e.g `primary`.
* @param string $widget Widget ID to check, e.g `custom_html`.
*
* @return bool
*/
function corporate_sidebar_has_widget( $sidebar, $widget ) {
global $sidebars_widgets;
if ( strpos( $sidebars_widgets[ $sidebar ][0], $widget ) !== false && is_active_sidebar( $sidebar ) ) {
return true;
} else {
return false;
}
}
+309
View File
@@ -0,0 +1,309 @@
<?php
/**
* Yeu Chay Bo
*
* This file adds the hero section to the Yeu Chay Bo Theme.
*
* @package SEOThemes\CorporatePro
* @link https://thuanbui.me/themes/yeuchaybo
* @author Thuan Bui
* @copyright Copyright © 2018 Thuan Bui
* @license GPL-2.0+
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
add_filter( 'genesis_attr_entry', 'corporate_entry_attr' );
/**
* Add itemref attribute to link entry-title.
*
* Since the entry-title is repositioned outside of the entry article, we need
* to add some additional microdata so that it is still picked up as a part
* of the entry. By adding the itemref attribute, we are telling search
* engines to check the hero-section element for additional elements.
*
* @since 1.0.0
*
* @link https://www.w3.org/TR/microdata/#dfn-itemref
* @param array $atts Entry attributes.
*
* @return array
*/
function corporate_entry_attr( $atts ) {
if ( is_singular() && did_action( 'genesis_before_entry' ) && ! did_action( 'genesis_after_entry' ) ) {
$atts['itemref'] = 'hero-section';
}
return $atts;
}
add_action( 'genesis_before', 'corporate_hero_section_setup' );
/**
* Set up hero section.
*
* Removes and repositions the title on all possible types of pages. Wrapped
* up into one function so it can easily be unhooked from genesis_before.
*
* @since 1.0.0
*
* @return void
*/
function corporate_hero_section_setup() {
// Remove default hero section.
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );
remove_action( 'genesis_before_loop', 'genesis_do_posts_page_heading' );
remove_action( 'genesis_archive_title_descriptions', 'genesis_do_archive_headings_open', 5, 3 );
remove_action( 'genesis_archive_title_descriptions', 'genesis_do_archive_headings_close', 15, 3 );
remove_action( 'genesis_before_loop', 'genesis_do_date_archive_title' );
remove_action( 'genesis_before_loop', 'genesis_do_blog_template_heading' );
remove_action( 'genesis_before_loop', 'genesis_do_taxonomy_title_description', 15 );
remove_action( 'genesis_before_loop', 'genesis_do_author_title_description', 15 );
remove_action( 'genesis_before_loop', 'genesis_do_cpt_archive_title_description' );
remove_action( 'genesis_before_loop', 'genesis_do_search_title' );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 );
// Add custom hero section.
add_action( 'corporate_hero_section', 'genesis_do_posts_page_heading' );
add_action( 'corporate_hero_section', 'genesis_do_date_archive_title' );
add_action( 'corporate_hero_section', 'genesis_do_taxonomy_title_description' );
add_action( 'corporate_hero_section', 'genesis_do_author_title_description' );
add_action( 'corporate_hero_section', 'genesis_do_cpt_archive_title_description' );
// Remove search results and shop page titles.
add_filter( 'woocommerce_show_page_title', '__return_null' );
add_filter( 'genesis_search_title_output', '__return_false' );
}
add_action( 'genesis_before_content', 'corporate_remove_404_title' );
/**
* Remove default title of 404 pages.
*
* @since 1.0.0
*
* @return void
*/
function corporate_remove_404_title() {
if ( is_404() ) {
add_filter( 'genesis_markup_entry-title_open', '__return_false' );
add_filter( 'genesis_markup_entry-title_content', '__return_false' );
add_filter( 'genesis_markup_entry-title_close', '__return_false' );
}
}
add_action( 'be_title_toggle_remove', 'corporate_genesis_title_toggle' );
/**
* Integrate with Genesis Title Toggle plugin
*
* @since 1.0.0
*
* @author Bill Erickson
* @link https://www.billerickson.net/code/genesis-title-toggle-theme-integration
*
* @return void
*/
function corporate_genesis_title_toggle() {
remove_action( 'corporate_hero_section', 'corporate_page_title', 10 );
remove_action( 'corporate_hero_section', 'corporate_page_excerpt', 20 );
}
add_action( 'corporate_hero_section', 'corporate_page_title', 10 );
/**
* Display title in hero section.
*
* Works out the correct title to display in the hero section on a per page
* basis. Also adds the entry title back in to the entry inside the loop.
*
* @since 1.0.0
*
* @return void
*/
function corporate_page_title() {
// Add post titles back inside posts loop.
if ( is_home() || is_archive() || is_category() || is_tag() || is_tax() || is_search() || is_page_template( 'page_blog.php' ) ) {
add_action( 'genesis_entry_header', 'genesis_do_post_title', 2 );
}
if ( class_exists( 'WooCommerce' ) && is_shop() ) {
genesis_markup( array(
'open' => '<h1 %s>',
'close' => '</h1>',
'content' => get_the_title( wc_get_page_id( 'shop' ) ),
'context' => 'entry-title',
) );
} elseif ( 'posts' === get_option( 'show_on_front' ) && is_home() ) {
genesis_markup( array(
'open' => '<h1 %s>',
'close' => '</h1>',
'content' => apply_filters( 'corporate_latest_posts_title', __( 'Latest Posts', 'yeuchaybo' ) ),
'context' => 'entry-title',
) );
} elseif ( is_404() ) {
genesis_markup( array(
'open' => '<h1 %s>',
'close' => '</h1>',
'content' => apply_filters( 'genesis_404_entry_title', __( 'Not found, error 404', 'yeuchaybo' ) ),
'context' => 'entry-title',
) );
} elseif ( is_search() ) {
genesis_markup( array(
'open' => '<h1 %s>',
'close' => '</h1>',
'content' => apply_filters( 'genesis_search_title_text', __( 'Search results for: ', 'yeuchaybo' ) ) . get_search_query(),
'context' => 'entry-title',
) );
} elseif ( is_page_template( 'page_blog.php' ) ) {
do_action( 'genesis_archive_title_descriptions', get_the_title(), '', 'posts-page-description' );
} elseif ( is_single() || is_singular() ) {
genesis_do_post_title();
}
}
add_action( 'corporate_hero_section', 'corporate_page_excerpt', 20 );
/**
* Display page excerpt.
*
* Prints the correct excerpt on a per page basis. If on the WooCommerce shop
* page then the products result count is be displayed instead of the page
* excerpt. Also, if on a single product then no excerpt will be output.
*
* @since 1.0.0
*
* @return void
*/
function corporate_page_excerpt() {
if ( class_exists( 'WooCommerce' ) && is_shop() ) {
woocommerce_result_count();
} elseif ( is_home() ) {
$id = get_option( 'page_for_posts' );
if ( has_excerpt( $id ) ) {
printf( '<p itemprop="description">%s</p>', do_shortcode( get_the_excerpt( $id ) ) );
}
} elseif ( is_search() ) {
$id = get_page_by_path( 'search' );
if ( has_excerpt( $id ) ) {
printf( '<p itemprop="description">%s</p>', do_shortcode( get_the_excerpt( $id ) ) );
}
} elseif ( is_404() ) {
$id = get_page_by_path( 'error-404' );
if ( has_excerpt( $id ) ) {
printf( '<p itemprop="description">%s</p>', do_shortcode( get_the_excerpt( $id ) ) );
}
} elseif ( ( is_single() || is_singular() ) && ! is_singular( 'product' ) && has_excerpt() ) {
printf( '<p itemprop="description">%s</p>', do_shortcode( get_the_excerpt() ) );
}
}
add_filter( 'genesis_attr_hero-section', 'corporate_hero_section_attr' );
/**
* Callback for dynamic Genesis 'genesis_attr_$context' filter.
*
* Add custom attributes for the custom filter.
*
* @since 1.0.0
*
* @param array $attr The element attributes.
*
* @return array
*/
function corporate_hero_section_attr( $attr ) {
$attr['id'] = 'hero-section';
$attr['role'] = 'banner';
return $attr;
}
add_action( 'genesis_before_content_sidebar_wrap', 'corporate_hero_section' );
/**
* Display the hero section.
*
* Conditionally outputs the opening and closing hero section markup and runs
* corporate_hero_section which all of our header functions are hooked to.
*
* @since 1.0.0
*
* @return void
*/
function corporate_hero_section() {
// Output hero section markup.
genesis_markup( array(
'open' => '<section %s><div class="wrap">',
'context' => 'hero-section',
) );
/**
* Do hero section hook.
*
* @hooked corporate_page_title - 10
* @hooked corporate_page_excerpt - 20
* @hooked genesis_do_posts_page_heading
* @hooked genesis_do_date_archive_title
* @hooked genesis_do_blog_template_heading
* @hooked genesis_do_taxonomy_title_description
* @hooked genesis_do_author_title_description
* @hooked genesis_do_cpt_archive_title_description
*/
do_action( 'corporate_hero_section' );
// Output hero section markup.
genesis_markup( array(
'close' => '</div></section>',
'context' => 'hero-section',
) );
}
+3897
View File
File diff suppressed because it is too large Load Diff
+123
View File
@@ -0,0 +1,123 @@
<?php
/**
* Yeu Chay Bo
*
* This file adds the RGBA Customizer control to the Yeu Chay Bo Theme.
*
* @package SEOThemes\CorporatePro
* @link https://thuanbui.me/themes/yeuchaybo
* @author Thuan Bui
* @copyright Copyright © 2018 Thuan Bui
* @license GPL-2.0+
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
/**
* RGBA Color Picker Customizer Control
*
* This control adds a secondary slider for opacity to the default WordPress
* color picker, and it includes logic to seamlessly convert between RGBa
* and Hex color values as opacity is added to or removed from a color.
*/
class RGBA_Customize_Control extends WP_Customize_Control {
/**
* Official control name.
*
* @var string $type Control name.
*/
public $type = 'alpha-color';
/**
* Add support for palettes to be passed in.
*
* Supported palette values are true, false,
* or an array of RGBa and Hex colors.
*
* @var array $palette Color palettes.
*/
public $palette;
/**
* Add support for showing the opacity value on the slider handle.
*
* @var bool $show_opacity Show opacity.
*/
public $show_opacity;
/**
* Enqueue scripts and styles.
*
* Ideally these would get registered and given proper paths
* before this control object gets initialized, then we could
* simply enqueue them here, but for completeness as a stand
* alone class we'll register and enqueue them here.
*/
public function enqueue() {
wp_enqueue_script(
'rgba-color-picker',
CHILD_THEME_URI . '/assets/scripts/min/customize.min.js',
array( 'jquery', 'wp-color-picker' ),
'1.0.0',
true
);
wp_enqueue_style(
'rgba-color-picker',
CHILD_THEME_URI . '/assets/styles/min/customize.min.css',
array( 'wp-color-picker' ),
'1.0.0'
);
}
/**
* Render the control.
*/
public function render_content() {
// Process the palette.
if ( is_array( $this->palette ) ) {
$palette = implode( '|', $this->palette );
} else {
// Default to true.
$palette = ( false === $this->palette || 'false' === $this->palette ) ? 'false' : 'true';
}
// Support passing show_opacity as string or boolean. Default to true.
$show_opacity = ( false === $this->show_opacity || 'false' === $this->show_opacity ) ? 'false' : 'true';
// Begin the output.
if ( isset( $this->label ) && '' !== $this->label ) {
echo '<span class="customize-control-title">' . esc_html( $this->label ) . '</span>';
}
?>
<label>
<?php
if ( isset( $this->description ) && '' !== $this->description ) {
echo '<span class="description customize-control-description">' . esc_html( $this->description ) . '</span>';
}
?>
<input class="alpha-color-control" type="text" data-show-opacity="<?php echo esc_html( $show_opacity ); ?>" data-palette="<?php echo esc_attr( $palette ); ?>" data-default-color="<?php echo esc_attr( $this->settings['default']->default ); ?>" <?php $this->link(); ?> />
</label>
<?php
}
}
+155
View File
@@ -0,0 +1,155 @@
<?php
/**
* Yeu Chay Bo
*
* This file adds theme specific functions to the Yeu Chay Bo Theme.
*
* @package SEOThemes\CorporatePro
* @link https://thuanbui.me/themes/yeuchaybo
* @author Thuan Bui
* @copyright Copyright © 2018 Thuan Bui
* @license GPL-2.0+
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
// Register Before Header widget area.
genesis_register_sidebar( array(
'id' => 'before-header',
'name' => __( 'Before Header', 'yeuchaybo' ),
'description' => __( 'Before Header widget area.', 'yeuchaybo' ),
) );
// Register Before Footer widget area.
genesis_register_sidebar( array(
'id' => 'before-footer',
'name' => __( 'Before Footer', 'yeuchaybo' ),
'description' => __( 'Before Footer widget area.', 'yeuchaybo' ),
) );
// Register Footer Credits widget area.
genesis_register_sidebar( array(
'id' => 'footer-credits',
'name' => __( 'Footer Credits', 'yeuchaybo' ),
'description' => __( 'Footer Credits widget area.', 'yeuchaybo' ),
) );
// Register Front Page widget areas.
genesis_register_sidebar( array(
'id' => 'front-page-1',
'name' => __( 'Front Page 1', 'yeuchaybo' ),
'description' => __( 'This widget area can be used to display a large hero image, video or slider on the home page.', 'yeuchaybo' ),
'before_title' => '<h1 itemprop="headline">',
'after_title' => '</h1>',
) );
genesis_register_sidebar( array(
'id' => 'front-page-2',
'name' => __( 'Front Page 2', 'yeuchaybo' ),
'description' => __( 'This widget area can be used to display brand logos on the home page.', 'yeuchaybo' ),
) );
genesis_register_sidebar( array(
'id' => 'front-page-3',
'name' => __( 'Front Page 3', 'yeuchaybo' ),
'description' => __( 'This widget area can be used to display a video section and grid of icons on the home page.', 'yeuchaybo' ),
) );
genesis_register_sidebar( array(
'id' => 'front-page-4',
'name' => __( 'Front Page 4', 'yeuchaybo' ),
'description' => __( 'This widget area can be used to display a large image on the home page.', 'yeuchaybo' ),
) );
genesis_register_sidebar( array(
'id' => 'front-page-5',
'name' => __( 'Front Page 5', 'yeuchaybo' ),
'description' => __( 'This widget area can be used to display an image gallery on the home page.', 'yeuchaybo' ),
) );
genesis_register_sidebar( array(
'id' => 'front-page-6',
'name' => __( 'Front Page 6', 'yeuchaybo' ),
'description' => __( 'This widget area can be used to display a call to action banner on the home page.', 'yeuchaybo' ),
) );
genesis_register_sidebar( array(
'id' => 'front-page-7',
'name' => __( 'Front Page 7', 'yeuchaybo' ),
'description' => __( 'This widget area can be used to display a pricing table and testimonials on the home page.', 'yeuchaybo' ),
) );
genesis_register_sidebar( array(
'id' => 'front-page-8',
'name' => __( 'Front Page 8', 'yeuchaybo' ),
'description' => __( 'This widget area can be used to display recent blog posts on the home page.', 'yeuchaybo' ),
) );
genesis_register_sidebar( array(
'id' => 'front-page-9',
'name' => __( 'Front Page 9', 'yeuchaybo' ),
'description' => __( 'This widget area can be used to display a newsletter sign up form on the home page.', 'yeuchaybo' ),
) );
add_action( 'genesis_before_header_wrap', 'corporate_before_header' );
/**
* Display Before Header widget area.
*
* This widget area is hooked to the before header wrap, inside of the
* site-header element and outside of the site-header wrap creating
* a full width section across the top of the screen while still
* keeping semantically valid inside of the site-header scope.
*
* @since 1.0.0
*
* @return void
*/
function corporate_before_header() {
genesis_widget_area( 'before-header', array(
'before' => '<div class="before-header widget-area"><div class="wrap">',
'after' => '</div></div>',
) );
}
add_action( 'genesis_footer', 'corporate_before_footer' );
/**
* Display Before Footer widget area.
*
* This widget area is hooked to the before footer wrap, inside of the
* site-footer element and outside of the site-footer wrap creating
* a full-width section above the footer widgets, keeping it all
* semantically valid inside of the site-footer element scope.
*
* @since 1.0.0
*
* @return void
*/
function corporate_before_footer() {
genesis_widget_area( 'before-footer', array(
'before' => '<div class="before-footer widget-area"><div class="wrap">',
'after' => '</div></div>',
) );
}
add_action( 'genesis_footer', 'corporate_footer_credits', 14 );
/**
* Display Footer Credits widget area.
*
* This widget area is hooked to the before footer wrap, inside of the
* site-footer element and outside of the site-footer wrap creating
* a full-width section above the footer widgets, keeping it all
* semantically valid inside of the site-footer element scope.
*
* @since 1.0.0
*
* @return void
*/
function corporate_footer_credits() {
genesis_widget_area( 'footer-credits', array(
'before' => '<div class="footer-credits widget-area"><div class="wrap">',
'after' => '</div></div>',
) );
}