This file contains hidden or 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 | |
| /** | |
| * Adds classes to your posts for a specific page (say, a custom post type archive for instance) | |
| * | |
| * @author Joshua David Nelson, joshuadnelson.com | |
| **/ | |
| // Three Columns | |
| function jdn_code_archive_post_class( $classes ) { | |
| $classes[] = 'one-third teaser'; // classes, these turn the format into three columns |
This file contains hidden or 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 | |
| /** | |
| * WordPress Query Comprehensive Reference | |
| * Compiled by luetkemj - luetkemj.com | |
| * | |
| * CODEX: http://codex.wordpress.org/Class_Reference/WP_Query | |
| * Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php | |
| */ | |
| $args = array( |
This file contains hidden or 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 is post is the child, sibling or the parent. | |
| * | |
| * Modified from http://css-tricks.com/snippets/wordpress/if-page-is-parent-or-child/ | |
| **/ | |
| function is_branch( $pid ) { // Check if parent or child | |
| global $post; | |
| if( is_page() && is_int( $pid ) && ( $post->post_parent == $pid || is_page( $pid ) ) ) { |
This file contains hidden or 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
| /** | |
| * This is the correct method of using wp_editor() | |
| **/ | |
| // Codex usage: | |
| wp_editor( $content, $editor_id, $settings = array() ); | |
| // Example of proper use in a widget | |
| wp_editor( 'content', 'content', array( 'textarea_name' => $this->get_field_id( 'content' ), ) ); | |
| // Alternate method when get_field_id is not available (options page or other) |
This file contains hidden or 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 | |
| /** | |
| * Flush Rewrite rules when the file containing this is changed, or every 48 hours | |
| * | |
| * @link https://codex.wordpress.org/Function_Reference/flush_rewrite_rules | |
| **/ | |
| // do not use on live/production servers | |
| add_action( 'init','maybe_rewrite_rules' ); | |
| function maybe_rewrite_rules() { |
This file contains hidden or 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 | |
| /** | |
| * Registering meta boxes | |
| * | |
| * Based on these metaboxes and a global metabox variable, but can be modified to suit others: | |
| * @link http://www.deluxeblogtips.com/meta-box/docs/define-meta-boxes | |
| */ | |
| // Add new metaboxes - hook into after the metaboxes have been defined, but before they have been registered | |
| add_action( 'admin_init', 'jdn_modify_metabox_fields', 1 ); |
This file contains hidden or 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 the file uploads to the emails | |
| * | |
| * @author Joshua David Nelson, [email protected] | |
| * | |
| * @link http://www.gravityhelp.com/documentation/page/Gform_user_notification_attachments | |
| * @link http://www.gravityhelp.com/documentation/page/Gform_notification | |
| **/ |