Skip to content

Instantly share code, notes, and snippets.

View hirejordansmith's full-sized avatar

Jordan Smith hirejordansmith

View GitHub Profile
@hirejordansmith
hirejordansmith / change-field-type-gravity-form-field.php
Created June 23, 2016 16:04
Change field type of a Gravity Form field
<?php
add_filter( 'gform_gf_field_create', 'convert_hidden_to_text', 10, 2 );
function convert_hidden_to_text( $field, $properties ) {
if( $field->get_input_type() == 'hidden' ) {
$field = new GF_Field_Text( $properties );
}
return $field;
}
@hirejordansmith
hirejordansmith / gf-currencies-with-three-decimals.php
Created May 14, 2016 11:07
GF Currencies with three decimals
<?php
add_filter( 'gform_currencies', function( $currencies ) {
$currencies['EUR']['decimals'] = 3;
return $currencies;
} );
?>
@hirejordansmith
hirejordansmith / move-genesis-entry-header-markup-to-site-header.php
Created March 28, 2016 17:16
Move Genesis Entry Header Markup to Site Header
<?php
@hirejordansmith
hirejordansmith / hide-gf-ajax-spinner.css
Created January 21, 2016 05:51
How to hide the Gravity Form Ajax Spinner
body img.gform_ajax_spinner {
display: none!important;
}
@hirejordansmith
hirejordansmith / how-to-get-the-current-page-url-with-php.php
Last active August 10, 2016 13:18
How to Get the Current Page URL with PHP
<?php
// Non WordPress
$current_url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
// WordPress Site
global $wp;
$current_url = add_query_arg( $wp->query_string, '', home_url( $wp->request ) );
@hirejordansmith
hirejordansmith / simple-responsive-video-shortcode.php
Created August 30, 2016 04:46
Simple Responsive Video Shortcode
<?php
// [yvideo vid="4mEbABPtTv8" /]
add_shortcode( 'yvideo', 'hjs_do_video' );
function hjs_do_video() {
$atts = shortcode_atts( array(
'vid' => ''
), $atts, 'yvideo' );
return '<div class="embed-container"><iframe src="https://www.youtube.com/embed/' . $atts['vid'] . '" frameborder="0" allowfullscreen></iframe></div>';
@hirejordansmith
hirejordansmith / replace-woocommerce-product-tabs-with-angular-js-tabs.php
Created October 20, 2016 15:23
Replace WooCommerce Product Tabs with Angular JS Tabs
<?php
// Removes WooCommerce Product Tabs
add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );
function woo_remove_product_tabs( $tabs ) {
unset( $tabs['description'] );
unset( $tabs['additional_information'] );
unset( $tabs['reviews'] );
@hirejordansmith
hirejordansmith / enable-gf-field-label-visibility-settings.php
Created February 10, 2016 11:24
Enable GF field label visibility settings
<?php
add_filter( 'gform_enable_field_label_visibility_settings', '__return_true' );
?>
@hirejordansmith
hirejordansmith / custom.css
Last active December 6, 2016 15:12
NDR AMP Code
body { font-family: Arial, sans-serif; }
.amp-wp-header { background: none; overflow: hidden; }
.amp-wp-header div { overflow: hidden; padding-bottom: 0; }
.amp-wp-title, h2, h3, h4 { font-weight: 400; }
.amp-wp-header a.amp-logo {
background: url(https://302mzo3s6lif441niv3xmjco-wpengine.netdna-ssl.com/wp-content/themes/nationaldebtrelief/images/logo-280.png) no-repeat;
margin: 0;
padding: 0;
width: 150px;
height: 45px;
@hirejordansmith
hirejordansmith / how-to-get-the-total-number-of-entries-for-a-gravity-form.php
Created September 12, 2016 20:18
How to get the total number of entries for a Gravity Form
<?php
$search_criteria = array();
$form_id = array(108, 109);
$start_date = date( 'Y-m-d' );
$end_date = date( 'Y-m-d' );
$search_criteria['start_date'] = $start_date;
$search_criteria['end_date'] = $end_date;
$result = GFAPI::count_entries( $form_ids, $search_criteria );
$formatted_number = number_format($result);