Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //* Enqueue Dashicons
- add_action( 'wp_enqueue_scripts', 'enqueue_dashicons' );
- function enqueue_dashicons() {
- wp_enqueue_style( 'dashicons' );
- }
- //* Add Twitter field in User Profile page in WP admin
- function my_new_contactmethods( $contactmethods ) {
- $contactmethods['twitter'] = 'Twitter (w/o the @)';
- return $contactmethods;
- }
- add_filter( 'user_contactmethods', 'my_new_contactmethods', 10, 1 );
- //* Create [twitter_link] shortcode
- add_shortcode( 'twitter_link', 'gamajo_twitter_link_shortcode' );
- function gamajo_twitter_link_shortcode() {
- $twitter_handle = ltrim( get_the_author_meta( 'twitter' ), '@' );
- if ( empty( $twitter_handle ) ) {
- return '';
- }
- return sprintf(
- '<span class="twitter"><a href="%s" target="_blank"><span class="dashicons dashicons-twitter"></span></a></span>',
- esc_url( 'https://twitter.com/' . $twitter_handle ),
- $twitter_handle
- );
- }
- //* Customize entry meta in the entry header
- add_filter( 'genesis_post_info', 'sp_post_info_filter' );
- function sp_post_info_filter( $post_info ) {
- if ( is_singular( 'post' ) ) {
- $post_info = 'by [post_author_posts_link] on [post_date] [twitter_link] [post_edit]';
- }
- return $post_info;
- }
Advertisement
Add Comment
Please, Sign In to add comment