Last active
December 10, 2015 07:11
-
-
Save jimi008/28f5fea2cf039bd4baa0 to your computer and use it in GitHub Desktop.
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 | |
/* | |
* 1. View Full Article | |
* | |
* This function produces a link to view the full article. | |
* | |
* @example <code>[view_full_article]</code> is the default usage | |
*/ | |
if ( ! function_exists( 'woo_shortcode_view_full_article' ) ) { | |
function woo_shortcode_view_full_article ( $atts ) { | |
$defaults = array( | |
'label' => __( 'Continue Reading', 'woothemes' ), | |
'before' => '', | |
'after' => '' | |
); | |
$atts = shortcode_atts( $defaults, $atts ); | |
$atts = array_map( 'wp_kses_post', $atts ); | |
$atts['label'] = 'Read more'; | |
$output = sprintf( '<span class="read-more">%1$s<a href="%3$s" title="%4$s">%4$s</a>%2$s</span> ', $atts['before'], $atts['after'], get_permalink( get_the_ID() ), $atts['label'] ); | |
return apply_filters( 'woo_shortcode_view_full_article', $output, $atts ); | |
} // End woo_shortcode_view_full_article() | |
} | |
add_shortcode( 'view_full_article', 'woo_shortcode_view_full_article' ); | |
?> |
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
[view_full_article label="Read more"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment