Skip to content

Instantly share code, notes, and snippets.

View thewebprincess's full-sized avatar

Dee Teal (she/her) thewebprincess

View GitHub Profile
@thewebprincess
thewebprincess / how-i-work-template.md
Created June 10, 2021 04:48 — forked from jazzsequence/how-i-work-template.md
Template for How I Like to Work posts

How I work

This is my own interpretation of how I like to work, feedback welcome! Especially if my own view of how I think I like to work doesn't match your experience of how it seems I like to work!

When I work

@thewebprincess
thewebprincess / dateform.js
Last active May 15, 2023 19:33
Gravity Forms - Datepicker extension for Date Range Fields
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 August 29, 2015 14:05
The building blocks for using Gravity Forms to build an online petition
<?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 January 10, 2014 06:09
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..
<?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 January 10, 2014 04:36
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.
<?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 April 27, 2016 15:47
This little snippet adjusts the Gravity Forms Address fields to allow for Australian Addresses. Includes AU states/
<?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 December 27, 2015 21:49
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 …
<?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.
*
<?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 September 7, 2016 23:55
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…
<?php
add_filter( 'widget_title', 'your_html_widget_title' );
/**
* html_widget_title function.
*
* @access public
* @param mixed $title
* @return void