Posts Loop doesn't account for add_filter() on post title

Posted in: Newspaper
Post count: 12

See the screenshot for an example of how it’s not working correctly in your theme: https://snipboard.io/NCvpsg.jpg

I created a function to add “[Expired]” to the title of my posts if the post is tagged expired. It works fine on the post title, latest post widgets and other places but not on the Newspaper Posts Loop element or Mega Menu. Why are you not allowing the add_filter() function to the title? and/or how do I configure this to work properly with Newspaper?

Here is my code for reference:
add_filter( ‘the_title’, ‘my_title_prefix_filter’, 10, 2 );
function my_title_prefix_filter( $title, $post_id ) {
$posttags = get_the_tags();
if( $post_id == get_the_ID() && $posttags ){
foreach($posttags as $tag) {
if ($tag->name == “expired”) {
$title = ‘<span class=”expired_text”>[Expired]</span> ‘ . $title;
}
}
}
return $title;
}

Post count: 18283

Hello !

Unfortunately this requires some custom work and we are not able to provide it due to support policy: https://forum.tagdiv.com/newspaper-theme-support/

We are sorry for the inconvenience !

Thank you !

Viewing 2 posts - 1 through 2 (of 2 total)
The forum ‘Newspaper’ is closed to new topics and replies.