[Resolved] Adding php snippet

Home Forums Support Adding php snippet

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1457524
    Dee Broughton

    I read the article about adding a php snippet and took the advice to use the Code Snippets plugin, and copied what I think is the code, but it’s still not doing anything. Is there another step I’m missing somewhere?

    http://www.dee.email/OPEN/SimPics/snippet.jpg

    #1457580
    Elvin
    Customer Support

    Hi Dee,

    You can filter the title output by using the the_title filter.

    You can try this out.

    add_filter('the_title', 'line_break_title');
    function line_break_title($title) {
    	$title = str_replace(' | ', '<br />', $title);
    	return $title;
    }

    Let us know if it works for you.

    A wise man once said:
    "Have you cleared your cache?"

    #1457595
    Dee Broughton

    Thank you, Elvin! I don’t actually understand why it needs a filter, but it worked great. Thank you very much! 🙂

    #1457605
    Elvin
    Customer Support

    I believe the snippet you were using was supposed to be used for the_title() function inside your content.php.

    Something like this.

    the_title( echo str_replace(' | ', '<br />', get_the_title()) );

    the_title() function is used to control the title output. Since we went the plugin route, we had to filter what the content.php outputs rather than editing its code.

    A wise man once said:
    "Have you cleared your cache?"

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.