Skip to content

Instantly share code, notes, and snippets.

View blogjunkie's full-sized avatar

David Wang blogjunkie

View GitHub Profile
@blogjunkie
blogjunkie / functions.php
Last active March 24, 2020 09:02
Define defaults for Beaver Builder button module Link: https://pro.wpbeaverworld.com/add-default-colors-button-module/
<?php
add_filter( 'fl_builder_settings_form_defaults', 'wpbw_default_color_button_module', 20, 2 );
function wpbw_default_color_button_module( $defaults, $type )
{
if( $type == "button-module" )
{
$defaults->bg_color = "f59120";
$defaults->bg_hover_color = "808080";
$defaults->text_color = "ffffff";
@blogjunkie
blogjunkie / remove-beaver-builder-from-admin-woocommerce.php
Created January 5, 2018 23:32 — forked from carasmo/remove-beaver-builder-from-admin-woocommerce.php
Remove Beaver Builder link and tab in Admin for WooCommerce pages
<?php
//* DON'T ADD ABOVE
/*
*
* READ ME:
* I'm using Beaver Builder for page post types and I don't want that option on
* WooCommerce store, cart, checkout, and my account pages. I don't want the client to ask why she can't change
@blogjunkie
blogjunkie / lessons-programs.php
Created June 19, 2018 08:02
Adds Lessons post type and Programs taxonomies. For Genesis child themes, the Primary sidebar will be replaced with a Lessons sidebar.
<?php
/*
Plugin Name: Lessons & Programs
Plugin URI:
Description: Adds Lessons post type and Programs taxonomies. For Genesis child themes, the Primary sidebar will be replaced with a Lessons sidebar.
Version: 1.0
Author: ClickWP
Author URI: https://clickwp.com
Text Domain: lessons-programs
Domain Path: /languages
@blogjunkie
blogjunkie / screen.js
Created August 9, 2018 07:11
Track clicks as GA events on all links with 'ga_event_click' CSS class
<script type="text/javascript">
jQuery(function($) {
/*
Track clicks as GA events on all links with 'ga_event_click' CSS class
Use data attributes to identify event fields. Example use:
<a href="http://example.com" class="ga_event_click" data-category="Button" data-action="play video" data-label="Play Button" data-value="0">Click me</a>
data-category will default to 'click' if no value is provided
data-action will default to the URL if no value is provided
@blogjunkie
blogjunkie / index.html
Created August 25, 2018 07:17
clickwp-faqs beacon
<!doctype HTML>
<html>
<head>
<title></title>
<style></style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.js"></script>
</head>
<body>
<a class="beacon-toggle" href="">Contact us</a>
@blogjunkie
blogjunkie / functions.php.php
Created April 19, 2019 03:16
Disabled featured image on certain post types for Astra theme
<?php
add_action( 'wp', 'child_disable_astra_featured_image' );
/**
* Disable Featured image on certain post types.
*/
function child_disable_astra_featured_image() {
$post_types = array( 'page', 'tribe_events' );
// return early if the current post type if not the one we want to customize.
@blogjunkie
blogjunkie / functions.php
Last active April 19, 2019 03:30
Force a page layout for post type in Astra theme
<?php
add_filter( 'astra_get_content_layout', 'child_astra_post_type_content_layout');
/**
* Force the container layout for post type in Astra theme
*/
function child_astra_post_type_content_layout ( $layout ){
// Apply only to specific post types
if ( is_singular( array( 'fl-builder-template' ) ) ) {
<?php
/**
* Template for ClickWP knowledgebase post type
* @since 3.0.5
*/
/**
* TODO
* 1. Popular posts section - KB articles tagged 'popular'
@blogjunkie
blogjunkie / functions.php
Last active March 2, 2020 14:51
Disable Thrive Architect (Content Builder) on specific post types
<?php // Do not copy this line
// Define a blacklist of posts that you don't want TCB to be enabled on
function sfp_tcb_blacklist() {
$blacklist = array(
'post',
'page',
'product'
);
return $blacklist;
@blogjunkie
blogjunkie / functions.php
Created March 24, 2020 09:06
Add Yoast Primary Category to WooCommerce Breadcrumbs
<?php
/**
* Add Yoast Primary Category to WooCommerce Breadcrumbs
*
* Uses the `woocommerce_get_breadcrumb` filter
*/
add_filter( 'woocommerce_get_breadcrumb', 'probb_filter_wc_crumbs', 10, 2 );
function probb_filter_wc_crumbs( $crumbs, $object )