Skip to content

Instantly share code, notes, and snippets.

View alexmustin's full-sized avatar

Alex Mustin alexmustin

View GitHub Profile
@alexmustin
alexmustin / text-widget.md
Last active November 9, 2018 01:14
Course Maker Documentation - Call to Action - Gravity Forms example

TITLE:

Start building your brand for free.

CONTENT:

[gravityform id="2" title="false" description="false"]

Sign up and we'll email you a free PDF about Personal Branding. We respect your privacy, and never share your information.

@alexmustin
alexmustin / functions.php
Last active April 9, 2019 16:41
Genesis - Force Gutenberg Pages to be Full-Width
<?php
//* Force full-width-content layout for Gutenberg pages
add_filter( 'genesis_site_layout', 'setGutenbergPageLayout' );
function setGutenbergPageLayout(){
if ( function_exists( 'has_blocks' ) && has_blocks( get_the_ID() ) ) {
return 'full-width-content';
}
}
@alexmustin
alexmustin / functions.php
Created December 12, 2018 20:13
WooCommerce - Custom Reviews tab content
<?php
/**
* Customize product data tabs
*/
add_filter( 'woocommerce_product_tabs', 'woo_custom_reviews_tab', 98 );
function woo_custom_reviews_tab( $tabs ) {
$tabs['reviews']['callback'] = 'show_custom_reviews_tab_content'; // Custom description callback
@alexmustin
alexmustin / custom-scripts.js
Last active January 2, 2019 21:37
Hello! Pro 1.x - Modified custom-scripts.js
/* // EQUAL HEIGHT BOXES // */
equalheight = function (container) {
var currentTallest = 0,
currentRowStart = 0,
rowDivs = new Array(),
$el,
topPosition = 0;
$(container).each(function () {
@alexmustin
alexmustin / file.sql
Last active February 8, 2019 19:39
SQL - Get emails for Users who have posted bbPress Topics or Replies
/* RUN THESE SEARCHES IN THE 'wp_posts' TABLE */
/* TOPICS */
SELECT DISTINCT user_email FROM wp_users,wp_posts WHERE ((wp_posts.post_author = wp_users.ID) AND (wp_posts.post_type = 'topic') AND (wp_posts.post_status = 'publish'))
/* REPLIES */
SELECT DISTINCT user_email FROM wp_users,wp_posts WHERE ((wp_posts.post_author = wp_users.ID) AND (wp_posts.post_type = 'reply') AND (wp_posts.post_status = 'publish'))
@alexmustin
alexmustin / style-editor.css
Created April 3, 2019 22:53
Gutenberg - add dotted lines around "AB Container" blocks
[data-type="atomic-blocks/ab-container"] > .editor-block-list__block-edit {
border: 2px dotted #ccc;
}
@alexmustin
alexmustin / blocks.php
Created April 8, 2019 22:02
Hello Pro 3 - Page Template files
<?php
/**
* Hello! Pro - Gutenberg 'Blocks' page template
*
* A template to force full-width layout, remove breadcrumbs, and remove the page title.
*
* Template Name: Blocks
*
* @package Hello Pro
* @author StudioPress
@alexmustin
alexmustin / shortcodes.php
Last active April 16, 2019 18:08
Simple Shortcode to display a Featured Page or Post
<?php
/**
* This code adds a custom Shortcode to display a "Featured Post."
*/
function featuredpost_shortcode( $atts ) {
// Var defaults
$defaults['id'] = 1;
$postID = '';
@alexmustin
alexmustin / functions.php
Last active April 22, 2019 19:50
Gutenberg - make Button blocks open links in a new window
<?php
//* Enqueue Script
add_action( 'wp_enqueue_scripts', 'yourtheme_enqueue_globaljs_script' );
function yourtheme_enqueue_globaljs_script() {
wp_enqueue_script( 'global-js', get_stylesheet_directory_uri() . "/global.js", array( 'jquery' ), '1.0', true );
}
@alexmustin
alexmustin / functions.php
Created April 25, 2019 23:42
PHP function to Convert Hex Colors to RGBA
<?php
//* Function to convert Hex colors to RGBA
function hex2rgba( $color, $opacity = false ) {
$defaultColor = 'rgb(0,0,0)';
// Return default color if no color provided
if ( empty( $color ) ) {
return $defaultColor;