Skip to content

Instantly share code, notes, and snippets.

add_action('save_post', 'myweb_duplicate_product', 10, 3);
function myweb_duplicate_product($post_id, $post, $update) {
$new_or_existing = '';
// only sync products from child sites, do nothing if its the parent site
if(get_current_blog_id() != 1){
// check if the post is new or if it is being updated
$myPost = get_post($post_id);
if( $myPost->post_modified_gmt == $myPost->post_date_gmt ){
// new product
$new_or_existing = 'new';
@grantambrose
grantambrose / functions.php
Last active July 26, 2016 03:13
Output page title fields after the header
// add our custom Page Title after the Site Header
add_action( 'fl_after_header', 'bb_after_header' );
function bb_after_header() {
// most home pages will be custom pages so we don't want to ouput the custom Page Title on the home page
if(!is_front_page()){
// get the value of the ACF background file we uploaded to the field.
// If you named your field a different name to $bb_page_title_bg, replace this with your field name
$bb_page_title_bg = get_field('bb_page_title_background');
// the below outputs the field. As the BB theme runs on Boostrap, we're using some
/* Add this into your style.css or whever else you'd like to add your CSS
- any rows with the CSS class bg-color-mobile will have the background image hidden on small devices */
@media only screen and (max-width: 767px) {
.bg-color-mobile .fl-row-content-wrap{background-image:none;}
}
@grantambrose
grantambrose / functions.php
Last active August 6, 2016 21:53
Add previous / post links to single posts
// add previous / next posts to single posts
// change fl_post_bottom_meta_open to the hook that is appropriate to your theme. Genesis would use genesis_before_comments as the hook
add_action( 'fl_post_bottom_meta_open', 'eo_prev_next_post_nav' );
function eo_prev_next_post_nav() {
if ( is_single() ) { ?>
<div class="navi-previous-next clear clearfix">
<div class="navi-previous navi-item"> <?php
$prevPost = get_previous_post();
@grantambrose
grantambrose / style.css
Created August 6, 2016 21:59
Add custom previous / next post navigation on your single posts - CSS
/* ----------------------
SINGLE POSTS
---------------------- */
/* SINGLE POST NAVIGATION - PREVIOUS / NEXT */
.navi-previous-next{clear:both;font-style:normal;}
.navi-previous-next img{max-width:100%;height:auto;margin-bottom:5px;}
.navi-previous-next .navi-item{width:48%;float:left;margin-left:4%;margin-bottom:30px;}
.navi-previous-next .navi-previous{margin-left:0;text-align:left;}
.navi-previous-next .navi-next{text-align:right;}
@grantambrose
grantambrose / style.css
Last active September 19, 2017 02:08
transparent header with Beaver Builder
/* Make the header transparent */
body .fl-page-header-primary{
background:transparent;
position:relative;
z-index: 10;
}
/* Remove the bottom border from the header
// if you do not add this there will be a faint line under your header */
header .fl-page-header-wrap { border-bottom: 0; }
@grantambrose
grantambrose / style.css
Created August 8, 2016 02:32
Transparent header with the Beaver Builder theme
/* FOR GREATER THAN THE MEDIUM DEVICE BREAKPOINT */
@media screen and (min-width: 993px) {
/* ROW STYLING */
.top-banner .fl-row-content-wrap{
margin-top: -115px;
padding-top: 200px;
padding-bottom: 80px;
}
}
@grantambrose
grantambrose / style.css
Last active August 8, 2016 02:37
Transparent header with the Beaver Builder theme
body .fl-page-header-primary, body .fl-page-bar{
background:transparent;
position:relative;
z-index: 10;
}
@grantambrose
grantambrose / style.css
Last active August 11, 2016 16:12
Convert the Beaver Builder Theme's Blog into a grid layout
/* Let's only convert the blog posts to a grid layout on medium devices and above */
@media only screen and (min-width: 992px) {
/* BLOG LAYOUT TO CONVERT IT TO A GRID with 2 blog posts across the row */
.fl-archive .fl-post{width:48%;float:left;margin-left:4%;}
.fl-archive .fl-post:nth-child(odd){margin-left:0;clear:both;}
}
@grantambrose
grantambrose / style.css
Last active August 11, 2016 16:15
Grid layout for the Beaver Builder theme blog in one easy step
/* Let's only convert the blog posts to a grid layout on medium devices and above */
@media only screen and (min-width: 992px) {
/* BLOG LAYOUT TO CONVERT IT TO A GRID with 3 blog posts across the row */
.fl-archive .fl-post{width:30%;float:left;margin-left:5%;}
.fl-archive .fl-post:nth-child(3n+1){margin-left:0;clear:both;}
}