Created
April 22, 2014 09:11
-
-
Save halgatewood/11171257 to your computer and use it in GitHub Desktop.
Update Excerpt More for HG Slider
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
// READ MORE, WHEN EXCERPT IT USED | |
add_action( 'after_setup_theme', 'flexslider_hg_after_theme_setup' ); | |
function flexslider_hg_after_theme_setup() | |
{ | |
remove_filter( 'excerpt_more', 'twentyeleven_auto_excerpt_more' ); // CHANGE THIS CALLBACK TO THE FUNCTION YOUR THEME IS USING | |
add_filter( 'excerpt_more', 'flexslider_hg_excerpt_more' ); | |
} | |
function flexslider_hg_excerpt_more( $more ) | |
{ | |
global $post; | |
echo $post->post_type; | |
if( $post->post_type == "slides" ) | |
{ | |
$url = get_post_meta( $post->id, "_slide_link_url", true ); | |
if($url) | |
{ | |
return ' <a href="' . esc_url($url) . '" class="flexslider-hg-view-more">' . apply_filters('flexslider_hg_view_more', __('View', 'flexslider_hg')) . ' →</a>'; | |
} | |
else | |
{ | |
return ' '; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment