Skip to content

Instantly share code, notes, and snippets.

@jamesmthornton
jamesmthornton / gist:1536bfde93fbc82b2bfb
Created March 2, 2015 23:07
Team Profile Page Template for Genesis Wordpress
<?php
/**
* This file adds the city team template to any Genesis 2.0+ Theme.
*
* @author Jim Thornton
* @package InboundFound
* @subpackage Customizations
*/
/*
Template Name: Team
@jamesmthornton
jamesmthornton / gist:abfdcba74ccb58a662b5
Last active February 12, 2018 19:44
team profiles functions.php customizations for genesis wordpress
<?php
add_action( 'init', 'team_post_type', 0 );
function team_post_type() {
// Create labels for your custom fields
$labels = array(
'name' => _x("Team", "post type general name"),
'singular_name' => _x("Team", "post type singular name"),
.profile {
position: relative;
margin: 0 0 20px;
float:left;
width: 40%;
margin-right: 5%;
margin-left: 5%;
}
@jamesmthornton
jamesmthornton / functions.php
Created June 26, 2016 02:49
Add Custom Text Field to Woocommerce Products Pages Post Type using Woocommerce Functions and Hooks
// Create Woocommerce Custom Field (here called Base Name)
add_action( 'woocommerce_product_options_general_product_data', 'woo_add_custom_general_fields' );
function woo_add_custom_general_fields() {
global $woocommerce, $post;
echo '<div class="options_group custom_wc_field">';
woocommerce_wp_text_input( // Make our text field with the following
array(
'id' => 'base_name',
@jamesmthornton
jamesmthornton / add gtm to genesis for wordpress (part 2)
Last active August 23, 2019 14:31
How to add second script for Google Tag Manager to Genesis on Wordpress (after opening body tag)
//* add Google Tag Manager after opening body tag for genesis on wordpress (part 2)
add_action( 'genesis_before', 'add_custom_google_tag_manager_2', 1 );
function add_custom_google_tag_manager_2() {
//* replace XXXXXXX with your GTM tracking ID
?>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<?php
@jamesmthornton
jamesmthornton / add gtm to genesis for wordpress (part 1)
Created May 10, 2017 22:05
How to add first script for Google Tag Manager to Genesis on Wordpress (closest to head tag as possible)
//* add Google Tag Manager after opening body tag for genesis on wordpress (part 1)
add_action( 'wp_head', 'add_custom_google_tag_manager_1', 1 );
function add_custom_google_tag_manager_1() {
//* replace XXXXXXX with your GTM tracking ID
?>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
@jamesmthornton
jamesmthornton / wordpress-share-buttons.php
Last active July 6, 2017 13:06
Share Buttons with URL generation for Wordpress inline PHP/HTML with fontawesome icons
<?php
?>
<div class="social-media-contents">
<div id="share-text" class="social-element">Sharing is caring: </div>
<div id="facebook-icon" class="social-element">
<a href="http://www.facebook.com/sharer/sharer.php?s=100&p[url]=<?php echo urlencode(get_permalink()); ?>" target="_blank">
<i class="fa fa-facebook-square" aria-hidden="true"></i>
</a>
</div>
@jamesmthornton
jamesmthornton / remove-intercom-on-blog-posts.php
Created July 8, 2017 20:00
Remove Intercom Snippet ONLY on Blog Posts in Wordpress
<?php
// conditionally remove the intercom snippet from wp_footer for posts but not pages
add_action('wp_enqueue_scripts','remove_intercom_blog_posts');
function remove_intercom_blog_posts () {
if ( is_single() ) {
remove_action( 'wp_footer', 'add_intercom_snippet' );
}
@jamesmthornton
jamesmthornton / if_divi_active_do_full_width_page.php
Created October 2, 2017 12:00
if divi builder is active on a page or post then force full width genesis layout on page
<?php
// if divi builder is active on a page or post then force full width genesis layout on page
add_filter( 'genesis_site_layout', 'if_divi_active_do_full_width_page' );
function if_divi_active_do_full_width_page() {
if(
// divi builder is being used on that page
) {
return 'full-width-content';
@jamesmthornton
jamesmthornton / dequeue_gravity_form_styles_for_form_1.php
Last active October 2, 2017 14:23
remove styles for specific gravity form by form id
<?php
// remove styles for gravity form id 1
// @ https://docs.gravityforms.com/gform_enqueue_scripts/#2-dequeue-stylesheets
add_action( 'gform_enqueue_scripts_1', 'dequeue_gravity_form_styles_for_form_1', 11 );
function dequeue_gravity_form_styles_for_form_1() {
wp_dequeue_style( 'gforms_datepicker_css' );
wp_dequeue_style( 'gforms_formsmain_css' );
wp_dequeue_style( 'gforms_ready_class_css' );