Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Dee Teal thewebprincess

🏠
Working from home
View GitHub Profile
@thewebprincess
thewebprincess / dateform.js
Last active Feb 19, 2021
Gravity Forms - Datepicker extension for Date Range Fields
View dateform.js
jQuery(function ($) {
var datepickerInArgs = {
minDate: 1,
defaultDate: 0,
dateFormat: 'dd/mm/yy',
changeMonth: true,
changeYear: true,
onClose: function( dateText, inst ) {
var d = $.datepicker.parseDate( inst.settings.dateFormat, dateText );
@thewebprincess
thewebprincess / petion-cpt.php
Last active Aug 29, 2015
The building blocks for using Gravity Forms to build an online petition
View petion-cpt.php
<?php
// ADDING CUSTOM POST TYPE
add_action('init', 'all_custom_post_types');
function all_custom_post_types() {
$types = array(
// Pledge Items
array('the_type' => 'pledge',
@thewebprincess
thewebprincess / filter-genesis-h1-content.php
Created Jan 10, 2014
Here's an example of how to filter your H1 content... you can use this to add span tags around your h1 if you want more styling control, but in this case I've added in a shortcode after the title to display sharing buttons. But you could put anything in here..
View filter-genesis-h1-content.php
<?php
add_filter( 'genesis_post_title_output', 'twp_amend_post_title_output');
/**
* Filter Genesis H1 Post Titles
*/
function twp_amend_post_title_output( $title ) {
if ( is_singular() )
$title = sprintf( '<h1 class="entry-title">%s' . do_shortcode('[ssba]') . '</h1>', apply_filters( 'genesis_post_title_text', get_the_title() ) );
@thewebprincess
thewebprincess / genesis-conditional-remove-footer-widgets.php
Created Jan 10, 2014
Simple piece of code to remove footer widgets from your site EXCEPT for on your Front Page - effective only if you're using a page template as your front page... If your homepage shows your list of latest posts, exchange is_front_page() for is_home() //Genesis 2.0 hooks used.
View genesis-conditional-remove-footer-widgets.php
View gravity-au.php
<?php
add_filter( 'gform_address_types', 'your_plugin_slug_australian_address' );
/**
* Set Gravity Forms custom addresses for Australia.
*
* @since 1.0.0
*
* @param array $address_types Existing address formats.
* @param int $form_id Form ID.
@thewebprincess
thewebprincess / gravity-au.php
Last active Apr 27, 2016
This little snippet adjusts the Gravity Forms Address fields to allow for Australian Addresses. Includes AU states/
View gravity-au.php
<?php
// Gravity Forms Custom Addresses (Australia)
add_filter('gform_address_types', 'australian_address', 10, 2);
function australian_address( $address_types, $form_id ) {
$address_types['australia'] = array(
'label' => 'Australia', //labels the dropdown
'country' => 'Australia', //sets Australia as default country
'zip_label' => 'Post Code', //what it says
'state_label' => 'State', //as above
@thewebprincess
thewebprincess / bulk-custom-post-types.php
Last active Dec 27, 2015
I find this an incredibly useful snippet for adding in a number of custom post types at once in client projects. It should be pointed out that this is fine for client projects but not inclusion in projects that my want to be translated in future, or for plugins being distributed... for the same reason, it's incompatible with translation (as far …
View bulk-custom-post-types.php
<?php
add_action('init', 'your_plugin_slug_custom_post_types');
/**
* Create Custom Post Types.
*
* @since 1.0.0
*
* @param array $types New Custom Post Types.
*
View count-through-repeater-loop.php
<?php
add_action( 'genesis_entry_content', 'your_plugin_slug_repeater_loop' );
/**
* your_plugin_slug_repeater_loop function.
*
* @access public
* @return void
*/
@thewebprincess
thewebprincess / add-html-to-widget-titles-wp.php
Last active Sep 7, 2016
You know those times when you want to make a widget title a link? And WordPress strips HTML? Here's a handy way to do that... Paste the code below in your functions file and then use square brackets instead of angled ones when writing your link around the title. For Example = [a href="http://mywebsite.com"] Link [/a] - WordPress doesn't recogniz…
View add-html-to-widget-titles-wp.php
<?php
add_filter( 'widget_title', 'your_html_widget_title' );
/**
* html_widget_title function.
*
* @access public
* @param mixed $title
* @return void
@thewebprincess
thewebprincess / template-print.php
Last active Oct 14, 2016
Template Print Snippet
View template-print.php
<?php
add_action('wp_head', 'your_show_template_function');
/**
* show_template function.
*
* @access public
* @return void
*/