Skip to content

Instantly share code, notes, and snippets.

@ibrahimkholil
Created October 23, 2018 09:59
Show Gist options
  • Save ibrahimkholil/a8705cd7070ca410361ca9f06359fa6b to your computer and use it in GitHub Desktop.
Save ibrahimkholil/a8705cd7070ca410361ca9f06359fa6b to your computer and use it in GitHub Desktop.
Wp post excerpt
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 &raquo;' . '</a></div>';
//$more.= ' <a href="'. get_permalink($post->ID) . '">' . 'Read More &raquo;' . '</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