Skip to content

Instantly share code, notes, and snippets.

@chrisegg
chrisegg / page-title-widget-home.php
Last active January 1, 2016 08:19
Removes the Page Title widget area from the homepage (Step 2 of 3)Usage: Place the following code in your themes home.php or front-page.php file
//* Removes Page Title widget area from the homepage
remove_action( 'genesis_after_header', 'cegg_pagetitle' );
@chrisegg
chrisegg / page-title-widget.css
Last active January 1, 2016 08:19
Add this code to your themes style.css file. This code will style the widget area nicely. Feel free to edit it as needed.
/* Page Title
--------------------------------------------- */
.pagetitle {
background-color: #222;
border-top: 5px solid #eaeaea;
margin: 0;
margin: 0;
padding: 40px;
padding: 2rem;
@chrisegg
chrisegg / Gravity_Forms_Field_Label_Visibility.php
Last active June 24, 2016 18:50
Gravity Forms Field Label Visibility
<?php
//* Do NOT include the opening php tag
add_filter( 'gform_enable_field_label_visibility_settings', '__return_true' );
<?php
/* Template Name: Sales
----------------------------------*/
//* Enqueue scripts and styles
add_action( 'wp_enqueue_scripts', 'cegg_image_load_scripts_styles' );
function cegg_image_load_scripts_styles() {
if ( has_post_thumbnail() ) {
@chrisegg
chrisegg / entry-background.php
Last active August 23, 2017 08:05
Add this code to your functions.php file. This code will add the backstretch functionality to your theme which handles the loading and sizing of the images.
<?php
//* Do NOT include the opening php tag
//* Enqueue scripts and styles
add_action( 'wp_enqueue_scripts', 'cegg_load_scripts_styles' );
function cegg_load_scripts_styles() {
if ( is_singular( array( 'post', 'page' ) ) && has_post_thumbnail() ) {
wp_enqueue_script( 'cegg-backstretch', get_bloginfo( 'stylesheet_directory' ) . '/js/backstretch.js', array( 'jquery' ), '1.0.0', true );
@chrisegg
chrisegg / radio-button-submit
Last active December 25, 2020 02:16
This snippet will allow you to use a radio button field to submit the form without using the submit button.
<script>
 jQuery(document).ready(function($) {
 $('input[type=radio]').on('change', function() {
 $(this).closest("form").submit();
 });
});
</script>
// Replace ID with your forms ID number.
body #gform_wrapper_ID .gform_footer input[type=submit] {
visibility: hidden;
}
@chrisegg
chrisegg / gforms_remove_button
Last active January 26, 2021 16:18
Replace the ID with your form ID number. Place this code in you functions.php file or a custom functions plugin
// Replace ID with your forms ID number.
add_filter( 'gform_submit_button_ID', '__return_false' );
@chrisegg
chrisegg / gravity_forms_readonly.js
Last active August 18, 2021 14:58
This code snippet works for text input fields only and can be placed in an HTML field within your form.
<script type="text/javascript">
jQuery(document).ready(function(){
/* apply only to a input with a class of gf_readonly */
jQuery(".gf_readonly input").attr("readonly","readonly");
});
</script>
@chrisegg
chrisegg / hide-gravityforms-admin-header.php
Created September 6, 2021 13:58
Hide the Gravity Forms brand header in the WP Admin that was added in v2.5.
<?php
//Copy everything below this point
add_action( 'admin_head', function () { ?>
<style>
header.gform-settings-header .gform-settings__wrapper {
/* this will hide the whole thing, including image */
display: none;
}