Skip to content

Instantly share code, notes, and snippets.

@bnecreative
Created November 7, 2020 22:34
Show Gist options
  • Save bnecreative/64635dc6800a2541f2c9c7d7e229dc40 to your computer and use it in GitHub Desktop.
Save bnecreative/64635dc6800a2541f2c9c7d7e229dc40 to your computer and use it in GitHub Desktop.
Sweetness Child Theme
<?php
/*
* Main Child Theme Functions
*
* @author Kerry Kline
* @copyright Copyright (c) 2020, Kerry Kline
* @link http://www.bnecreative.com
* @package Child Theme for BNE Sweetness v2 WordPress Framework
*
*/
/* ===================================================================================
* Run BNE Filters BEFORE the Framework is loaded
* ================================================================================ */
/* ===================================================================================
* Run BNE WordPress Framework (required)
* ================================================================================ */
require_once( get_template_directory() . '/framework/bne-functions.php' );
/* ===================================================================================
* Child Theme Functions
* ================================================================================ */
/*
* Enqueue Child Theme scripts
*
*/
/*
function bne_childtheme_scripts(){
// Child Theme JS
wp_enqueue_script( 'bne-child-js', get_stylesheet_directory_uri() . '/assets/js/theme.js', array('jquery') );
}
add_action( 'wp_enqueue_scripts', 'bne_childtheme_scripts', 11 );
*/
/*
* Inline Header Scripts and Tags
*/
/*
function bne_child_wp_head() {
}
add_action( 'wp_head', 'bne_child_wp_head' );
*/
/*
* Inline Footer Scripts/Content
*/
/*
function bne_child_wp_footer() {
}
add_action( 'wp_footer', 'bne_child_wp_footer' );
*/
/*
* Configure Theme Settings
*
* Allows overriding parent theme settings and hooks.
*
*/
function bne_child_theme_setup() {
// Framework Page Option Overrides
/*
add_filter( 'bne_get_page_option', function($options) {
if( is_singular('custom_post_type') ) {
$options['sidebar_layout'] = 'left-sidebar';
}
return $options;
});
*/
// Remove Footer Menu
//unregister_nav_menu( 'footer-menu' );
// Move Nav Button Location
//remove_action( 'bne_header_before', 'bne_mobile_nav_btn' );
//add_action( 'bne_header_menu_before', 'bne_mobile_nav_btn' );
// Adjust Column Classes
/*
add_filter( 'bne_get_column_classes', function( $classes, $column, $layout ) {
if( $layout == 'fourth_three_fourth' ) {
if( $column == 'left-header' ) {
$classes = 'col-md-2';
} else {
$classes = 'col-md-10';
}
}
return $classes;
}, 10, 3 );
*/
// Move Default Footer Widget Location
//remove_action( 'bne_footer_content', 'bne_footer_content_default' );
//add_action( 'bne_footer_before', 'bne_footer_widgets_alternate' );
// Featured Area Shadow
//add_filter( 'bne_featured_area_shadow', function() { return '4'; } );
// Sidebar Layout Sizes and Breakpoints
//add_filter( 'bne_sidebar_layout_width', function() { return '9-3'; } );
//add_filter( 'bne_sidebar_layout_responsive', function() { return 'md'; } );
//add_filter( 'bne_sidebar_layout_gutter', function() { return '60'; } );
// Add Page Options
/*
add_action( 'cmb2_init_before_hookup', function() {
$metabox = cmb2_get_metabox( 'bne_theme_meta_box_page' );
if( $metabox ) {
$metabox->add_field( array(
'id' => 'bne_page_action_bar',
'name' => 'Action Bar Text',
'desc' => 'Enter a quick action message that is displayed before the page content',
'type' => 'text',
) );
}
});
*/
// Enable basic dark styles on the frontend.
// add_filter( 'bne_dark_theme_mode', '__return_true' );
// Enable basic dark styles for the block editor.
// add_filter( 'bne_editor_dark_theme_mode', '__return_true' );
// Enqueue Custom Google Fonts
/*
add_filter( 'bne_enqueue_google_font', function( $fonts ) {
// Each font stack should look be formatted as: name:style1,style2.
$fonts[] = 'Srisakdi:400,700';
return $fonts;
});
*/
// Enqueue Editor Styles
/*
add_action( 'admin_enqueue_scripts', function() {
$css = 'div { color: red; }';
wp_add_inline_style( 'bne-blocks', $css );
});
*/
// Enable FA Pseudo (CSS Before)
/*
add_filter( 'bne_fontawesome_setup', function($fa) {
$fa['pseudo'] = true;
return $fa;
}, 10, 2);
*/
}
add_action( 'after_setup_theme', 'bne_child_theme_setup' );
/*
* Add Customizer Options
*
*/
/*
Kirki::add_field( $kirki_prefix, array(
'type' => 'background',
'settings' => 'footer_widgets_bg',
'label' => esc_attr__( 'Footer Widgets Background', 'bne' ),
'description' => '',
'section' => $kirki_prefix.'_section_backgrounds',
'default' => array(
'background-color' => '',
'background-image' => '',
'background-repeat' => 'no-repeat',
'background-position' => 'center center',
'background-size' => 'cover',
'background-attachment' => 'scroll',
),
) );
*/
/*
* Header Before Content
*
* Adds custom content above the main header.
*/
/*
function bne_child_header_before() {
?>
<div id="header-above">
<div class="content-area-width">
<div class="row">
<div class="col-md-6">
Left
</div>
<div class="col-md-6">
Right
</div>
</div>
</div>
</div>
<?php
}
add_action( 'bne_header_before', 'bne_child_header_before' );
*/
/*
* Custom Featured Area
*
* Adds custom content above the main header.
*/
/*
function bne_child_featured_content() {
?>
<div id="featured-wrapper">
<div class="content-area-width">
<div class="row">
<div class="col-md-6">
Left
</div>
<div class="col-md-6">
Right
</div>
</div>
</div> <!-- /.content-area-width -->
</div> <!-- /#featured-wrapper -->
<?php
}
add_action( 'bne_featured_area', 'bne_child_featured_content' );
*/
/* Display Social Links in Footer */
/*
add_action( 'bne_footer_sub_content_before', function() {
echo bne_contact_bar(
$location = 'footer',
$color = 'dark',
$shape = 'transparent',
$class = '',
$size = '60px',
$align = 'center',
$target = ''
);
});
*/
/* Display Social Links within the menu */
/*
add_action( 'bne_header_menu_addon', function() {
$contact_bar = get_theme_mod( 'header_contact_bar', true );
if( $contact_bar == 'true' ) {
echo bne_contact_bar( 'header' );
}
});
*/
/* ===================================================================================
* WP Core
* ================================================================================ */
/* ===================================================================================
* Plugins
* ================================================================================ */
/*
* Gravity Forms
*/
add_filter( 'gform_enable_field_label_visibility_settings', '__return_true' );
add_filter( 'gform_form_list_columns', function($columns) {
$columns['shortcode'] = 'Shortcode';
return $columns;
}, 10, 1 );
add_action( 'gform_form_list_column_shortcode', function($item) {
echo '[gravityform id="'.$item->id.'" title="false" description="false" ajax="true"]';
}, 10, 1 );
// Add Captcha terms to forms
/*
add_filter( 'gform_get_form_filter', function( $form_string, $form ) {
$terms = '<style>.gf-recaptcha-terms { display: block; }.gfield.h-label label.gfield_label {display: none !important;}</style>';
// Google Terms
//$terms .= '<div class="gf-recaptcha-terms small my-3"><em>This site is protected by reCAPTCHA and the Google <a href="https://policies.google.com/privacy" style="color: inherit;">Privacy Policy</a> and <a href="https://policies.google.com/terms" style="color: inherit;">Terms of Service</a> apply.</em></div>';
// hCaptcha Terms
$terms .= '<div class="gf-recaptcha-terms small my-3"><em>This site is protected by hCaptcha and its <a href="https://hcaptcha.com/privacy" style="color: inherit;">Privacy Policy</a> and <a href="https://hcaptcha.com/terms" style="color: inherit;">Terms of Service</a> apply.</em></div>';
$form_string = str_replace('</form>', '</form>'.$terms, $form_string);
return $form_string;
}, 10, 2);
*/
/*
Theme Name: Sweetness Child Theme
Description: A child theme based on Sweetness v2 by BNE Creative.
Author: Kerry Kline
Author URI: http://www.bnecreative.com
Version: 2020.11.07
Template: sweetness
*/
/*
* IMPORTANT! There is no need to @import the parent's
* main style.css file. It's already enqueued!!
*/
/* ===========================================================
* General
* ======================================================== */
/*
* Available CSS Variables
* There are a number of pre-defined variables available
* from the theme. CSS Variables can be evoked by using.
*
* Example:
* .class{
* color: var(--theme-primary-color);
* }
* :root {
* --theme-dark-base: #333 !important;
* }
*
*
* Theme General Vars:
* --theme-content-width
* --theme-sidebar-gutter
* --theme-default-btn-color
* --theme-heading-font-family
* --theme-body-font-family
* Theme Palette Colors:
* --theme-primary-color
* --theme-secondary-color
* --theme-tertiary-color
* --theme-dark-color
* --theme-light-color
* --theme-success-color
* --theme-danger-color
* --theme-warning-color
* --theme-info-color
* Dark Theme:
* --theme-dark-base
* --theme-dark-base-secondary
*
*
* In addition, there are numerous Bootstrap variables that can be found
* by using the browser inspector and finding the :root {}
*
*/
/* == Typography == */
@media (max-width: 600px) {
.heading-main {
line-height: 1;
font-size: 10vw !important;
}
}
/* Link Hover Declaration */
p > a,
.footer-widgets .menu a,
.footer-copy a {
transition: all .25s ease-out;
}
p > a:hover,
.footer-widgets .menu a:hover,
.footer-copy a:hover {
box-shadow: inset currentColor 0 -2px 0;
}
/* == Utility == */
.overflow-visible {
overflow: visible;
}
@media (max-width: 768px) {
.wp-block-columns.col-xs-3-columns .wp-block-column {
flex-basis: 33% !important;
}
.wp-block-columns.col-xs-2-columns .wp-block-column {
flex-basis: 50% !important;
}
}
.bg-gradient-primary-secondary:before {
content: "";
display: block;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: linear-gradient(120deg,var(--theme-primary-color),var(--theme-secondary-color));
}
.rounded-xlg {
border-radius: .6rem !important;
}
/* ===========================================================
* Menu
* ======================================================== */
/* == Mobile Nav btn ==*/
/*
@media (max-width: 767px) {
.btn-navbar.open-nav {
position: relative;
top: 0;
left: 0;
right: 0;
color: white;
background-color: var(--theme-primary-color);
}
}
*/
/* == Menu == */
/*
.menu-wrapper {}
#access {}
.menu-phone > a {
background: var(--theme-secondary-color) !important;
color: white !important;
font-size: 1.2rem !important;
}
#header-wrapper .sticky-only {
display: none;
}
*/
/* ===========================================================
* Header
* ======================================================== */
/*
#header-above {
background-color: var(--theme-primary-color);
color: white;
padding: 10px 30px;
box-shadow: 0px 1px 5px rgba(0,0,0,.8);
}
#header-above a[href^='tel:'] {
color: inherit;
}
*/
/*
@media (min-width: 768px) {
#header-wrapper {
padding-top: 20px;
padding-bottom: 20px;
}
#header-wrapper .header-content {
padding-bottom: 0;
}
#header-wrapper .header-content > .row {
align-items: center;
}
}
*/
/*
#sticky-header #header-above {
margin: 0 -30px;
z-index: 1;
}
*/
/* ===========================================================
* Main
* ======================================================== */
/* ===========================================================
* Footer
* ======================================================== */
.footer-widgets .menu {
list-style: none;
padding: 0;
}
.footer-widgets .menu li {
font-size: 1.1rem;
}
/* ===========================================================
* Blocks
* ======================================================== */
/* == Block: Text Media == */
.wp-block-media-text:not(.alignfull) {
padding-top: 3rem;
padding-bottom: 3rem;
}
@media (max-width: 600px) {
/* Force Media side to always be first */
.wp-block-media-text.is-stacked-on-mobile.has-media-on-the-right .wp-block-media-text__media {
grid-row: 1;
}
.wp-block-media-text.is-stacked-on-mobile.has-media-on-the-right .wp-block-media-text__content {
grid-row: 2;
}
.wp-block-media-text .wp-block-media-text__content {
padding-top: 20px;
}
}
/* ===========================================================
* Shortcodes
* ======================================================== */
/* ===========================================================
* Plugins
* ======================================================== */
/* == Gravity Forms == */
/*
#wrapper .gform_wrapper .gform_footer {
margin-top: 0;
}
#wrapper .gform_wrapper .gform_footer input[type=submit] {
width: calc(100% - 16px);
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment