Does anyone know how to change the “Read More” links based on category when using the magazine?
So that if the post is in the category “News”, instead of “read more” it shows “Go to News” and if the post is in the category “Events”, that it shows “Go to Event” for example.
I use this function to change it globally:
function custom_more_script(){
?>
<script>
(function($){
$(document).ready(function(){
$(".more-link").text("Mehr lesen");
});
})(jQuery);
</script>
<?php
}
add_action('wp_footer', 'custom_more_script');
But I can’t figure out how to change it based on the category.
Kind Regards Rene
Hi Ostsys,
Category pages should have this class on them .category-name, for example category with name of news should be using this class:
.category-news
so you should be able to add this code inside your jquery code:
$(".category-news .more-link").text("Go to News");
Hope it helps.
Best regards,
Nikko