• Hi guys

    Is it possible to add some code (possibly to my functions.php file) that will prefix all post titles in a certain category with the word ‘Podcast’?

    Thanks ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • Try something like:

    function add_podcast($title) {
    	$title = 'Podcast' . $title;
    	return $title;
    }
    add_filter('the_title', 'add_podcast');
    Thread Starter Mark

    (@markjcasey)

    Thanks esmi ??

    Just looking at your code, how does that only specify posts only within the pocdcast category?

    Oops – missed that bit. Change it to:

    function add_podcast($title) {
    	if( in_category( 'foobar' ) ) $title = 'Podcast' . $title;
    	return $title;
    }
    add_filter('the_title', 'add_podcast');

    and replace foobar with the slug of your chosen category.

    Thread Starter Mark

    (@markjcasey)

    Sweet ??

    Thanks very much.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add prefix to post tiles in a certain category’ is closed to new replies.