Created
October 23, 2018 09:59
-
-
Save ibrahimkholil/a8705cd7070ca410361ca9f06359fa6b to your computer and use it in GitHub Desktop.
Wp post excerpt
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
add_filter( 'the_excerpt', array($this,'new_excerpt_more')); | |
add_filter( 'excerpt_more', array($this,'realestate_excerpt_more')); | |
/* | |
*Excerpt with link | |
* | |
* | |
*/ | |
public function new_excerpt_more($more) { | |
global $post; | |
$more.=' <div class="post-readmore pt-3"><a href="'. get_permalink($post->ID) . '">' . 'Read More »' . '</a></div>'; | |
//$more.= ' <a href="'. get_permalink($post->ID) . '">' . 'Read More »' . '</a>'; | |
return $more; | |
} | |
/** | |
* Replaces "[...]". | |
* @return link | |
*/ | |
function realestate_excerpt_more($more) { | |
if (post_password_required()) { | |
return; | |
} | |
$link = ''; | |
return $link; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment