Skip to content

Instantly share code, notes, and snippets.

View blogjunkie's full-sized avatar

David Wang blogjunkie

View GitHub Profile
@blogjunkie
blogjunkie / style.css
Last active March 26, 2020 02:03
Fix for WPForms reCaptcha badge getting out of position
/* Fix for Convert Pro throwing reCaptcha badge out of position */
.wpforms-recaptcha-container .g-recaptcha {
transform: none !important;
}
@blogjunkie
blogjunkie / functions.php
Last active March 28, 2020 03:51
Disable Block Editor default FullScreen mode in WordPress 5.4
<?php // don't copy this line -- paste the code below into your theme's functions.php file
add_action( 'enqueue_block_editor_assets', 'jba_disable_editor_fullscreen_by_default' );
/**
* Disable Block Editor default FullScreen mode in WordPress 5.4
*
* @author @audrasjb
* @link https://jeanbaptisteaudras.com/en/2020/03/disable-block-editor-default-fullscreen-mode-in-wordpress-5-4/
*/
function jba_disable_editor_fullscreen_by_default() {
@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 )
@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;
<?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 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' ) ) ) {
@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 / 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 / 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 / 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