Skip to content

Instantly share code, notes, and snippets.

@jimi008
Last active December 10, 2015 07:11
Show Gist options
  • Save jimi008/28f5fea2cf039bd4baa0 to your computer and use it in GitHub Desktop.
Save jimi008/28f5fea2cf039bd4baa0 to your computer and use it in GitHub Desktop.
<?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' );
?>
[view_full_article label="Read more"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment