Why my code doesn’t work?
-
I’m trying to create a function to make bold e-mails in the content of job listings, but it seems not working.
I already tried on the post-type “post” and it works, but when I change to “job_listing”, it seems not working – why is that?
function bold_emails_in_job_listings($content) { var_dump(is_singular('job_listing')); if (is_singular('job_listing')) { $content = preg_replace_callback('/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/', function($matches) { return '<strong>' . $matches[0] . '</strong>'; }, $content); } return $content; } add_filter('the_content', 'bold_emails_in_job_listings');
The page I need help with: [log in to see the link]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Why my code doesn’t work?’ is closed to new replies.