Created
March 21, 2024 23:09
-
-
Save Archie22is/0207cb1e9e7ebccf40f200f2ce0c4361 to your computer and use it in GitHub Desktop.
Content type related post excerpt in WordPress (Not Clean)
This file contains hidden or 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 | |
function new_excerpt_more($more) { | |
global $post; | |
$current_post_type = get_post_type(); | |
if($current_post_type == 'case_study'): | |
return '<a href="'. get_permalink($post->ID) . '"><i class="fa fa-arrow-circle-o-right"></i> Read the case study</a>'; | |
endif; | |
if($current_post_type == 'post'): | |
return '<a href="'. get_permalink($post->ID) . '"><i class="fa fa-arrow-circle-o-right"></i> Read more</a>'; | |
endif; | |
} | |
add_filter('excerpt_more', 'new_excerpt_more'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment