As title i would to allow html in title/excerpt or enable custom field in flex block for post ID
Explain better :
I’m a publisher and i use Tagdiv newspaper by several years . But i have needed some editorial functions for my digital newspaper website , basically a secondary title that i can custom with words/hyperlinks (as big newspaper website):
Custom field was the simple solution to make this but in tagdiv composer in frontpage there isn’t custom field in flex blocks
So secondary solution was to hook the_title and inject custom fields by post ID but the_title doesn’t allow html so i cannot skin with css ( using esc_attr html code appairs in homepage but it’s not render )
My question is :
In tagdiv is there the possibility to enable HTML codes in the_title so that I can add the desired functionality to the title?
Thanks
I don’t think it’s not possible,
I managed it myself through simple snippets and custom fields, but the problem is that you have some function that eliminates the html codes from the frontpage when I hook the_title with my snippets so i cannot change , for example, color of font of secondary title , or adding padding .
this is the code , you can use it
function title_kicker ( $title, $post_id ) {
if ( ! is_single() && ! is_admin() && $field00 = get_post_meta( $post_id, ‘post_12345’, true ) ) {
$title = ‘<span class=”title_kicker” style=”letter-spacing: 0px !important;font-size:16px;color:red;text-transform:uppercase;line-height:20px;”>’.$field00.'<br/> </span>’ .$title;
}
return $title;
}
add_filter( ‘the_title’, ‘title_kicker’ , 10, 2 );
If I do the same thing with the twenty_twenty everything works fine
So I would like to know how you manipulate the_title and how can I precisely execute the html tags in the_title
If I try wp_kses it crashes, if I try esc_attr the code becomes visible but not executable
Also I have 50 websites with newspaper and I don’t want to have to migrate to another template that supports this feature (like jnews or foxiz)
Hello @zeropiquet !
We do not use those WordPress functions to display the title in flex blocks. We use custom made functions for that purpose. You can check the “get_title” function in the td-composer/legacy/common/wp_booster/td_module.php file.
I hope that helps you!
Thank you!