This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Check if the page has a gravity form. | |
* | |
* @since 1.0.0 | |
* | |
* @param int $id Post or page id, default to false. | |
* | |
* @return boolean | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( ! function_exists( 'plugin_do_action' ) ) { | |
function plugin_do_action( $filter, $modifiers ) { | |
if ( ! is_array( $modifiers ) ) { | |
$modifiers = array( $modifiers ); | |
} | |
// add an empty modifier so the base filter will be applied as well | |
array_unshift( $modifiers, '' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.ui-datepicker { | |
background-color: #fff; | |
border: 1px solid #66AFE9; | |
border-radius: 4px; | |
box-shadow: 0 0 8px rgba(102,175,233,.6); | |
display: none; | |
margin-top: 4px; | |
padding: 10px; | |
width: 240px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(function( $ ){ | |
// Sets the horizontal location of the lines | |
$(document).ready(function () { | |
var entryHeaderWidth = $('.entry-title').width(); | |
var titleWidth = $('.entry-title .title').width(); | |
$('.entry-title span.before').css("right", entryHeaderWidth/2+titleWidth/2 ); | |
$('.entry-title span.after').css("left", entryHeaderWidth/2+titleWidth/2 ); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add a parallax image behind a page entry header in genesis. | |
* | |
* @author Joshua David Nelson, josh@joshuadnelson.com | |
*/ | |
// Parallax Image | |
add_action( 'genesis_header', 'parallax_image', 15 ); | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Correct method for WordPress 4.3 | |
* @see https://make.wordpress.org/core/2015/07/02/deprecating-php4-style-constructors-in-wordpress-4-3/ | |
* @see http://codex.wordpress.org/Widgets_API | |
*/ | |
class My_Widget extends WP_Widget { | |
/** | |
* Sets up the widgets name etc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Check if posts exist in a post type. | |
* | |
* @author Joshua David Nelson, josh@joshuadnelson.com | |
* | |
* @param string $post_type The post type slug (required). | |
* @param | |
*/ | |
function posts_exist( $post_type, $post_status = 'publish' ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wp_head', 'remove_feeds_from_wp_head', 1 ); | |
/** | |
* Remove feed links from wp_head | |
*/ | |
function remove_feeds_from_wp_head() { | |
// Remove feed links | |
remove_action( 'wp_head', 'feed_links', 2 ); | |
remove_action( 'wp_head', 'feed_links_extra', 3 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add custom metabox to Genesis CPT Archive Settings. | |
* | |
* @author Joshua David Nelson, josh@joshuadnelson.com | |
* | |
* @link https://joshuadnelson.com/adding-metaboxes-to-genesis-cpt-archive-settings | |
*/ | |
class JDN_Genesis_CPT_Archive_Settings { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* For a post to draft if specific meta is invalid, in this case the start and end date/time. | |
* | |
* @author Joshua David Nelson, josh@joshuadnelson.com | |
*/ | |
add_action( 'updated_post_meta', 'jdn_force_draft', 10, 2 ); | |
function jdn_force_draft( $meta_id, $post_id ) { | |
if( get_post_type( $post_id ) == 'events' ) { | |
$start = get_post_meta( $post_id, 'event_start', true ); |