Trying to add some custom text into WordPress Post title via function.php
Question
I need to add a custom text in wordpress Post title dynamically which I’m trying to add via this code in function.php
Following code is not working
add_filter('the_title', 'new_title', 10, 2); function new_title($title, $id) { if('babysitters' == get_post_type($id)){ $exclusive = get_field('exclusive', $id); // pass the id into get_field $title = $title .', ' .$exclusive->y; } return $title; }
0
functions, javascript, php, variables, wp-title
3 years
2020-07-07T08:10:20-05:00
2020-07-07T08:10:20-05:00 0 Answers
65 views
0
Leave an answer