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
| // Display Current Year | |
| function year_shortcode() { | |
| $year = date('Y'); | |
| return $year; | |
| } | |
| add_shortcode('year', 'year_shortcode'); |
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
| // First Name of Logged In User Shortcode | |
| function ni_firstname() { | |
| $user = wp_get_current_user(); | |
| $firstname = $user->user_firstname; | |
| return $firstname; | |
| } | |
| add_shortcode('firstname', 'ni_firstname'); |
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
| // Render User First Name Possessive | |
| function ni_UserFirstName() { | |
| global $current_user; | |
| get_currentuserinfo(); | |
| $firstname = $current_user->user_firstname; | |
| if (substr($current_user->user_firstname, -1) == 's') { | |
| return $firstname . "'"; | |
| } | |
| else |
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
| // Set Excerpt Length and Add Ellipses | |
| function custom_excerpt_length( $length ) { | |
| return 30; | |
| } | |
| add_filter( 'excerpt_length', 'custom_excerpt_length', 999 ); | |
| function custom_excerpt_more( $more ) { | |
| return '…'; | |
| } |
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
| // Change Read More Text in Excerpt | |
| function et_excerpt_length($length) { | |
| return 30; | |
| } | |
| add_filter('excerpt_length', 'et_excerpt_length'); | |
| /* Add link to end of excerpt in a div for styling */ | |
| function et_excerpt_more($more) { |
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
| // Makes Gallery Images Link to Media File Instead of Attachment Page | |
| add_shortcode( 'gallery', 'my_gallery_shortcode' ); | |
| function my_gallery_shortcode( $atts ) | |
| { | |
| $atts['link'] = 'file'; | |
| return gallery_shortcode( $atts ); | |
| } |
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
| // Prepopulate Pages and Posts with Default Content | |
| add_filter( 'default_content', 'ni_default_editor_content' ); | |
| function ni_default_editor_content( $content ) { | |
| global $post_type; | |
| switch( $post_type ) | |
| { | |
| case 'post': | |
| $content = 'Default content for blog posts.'; |