• i used this code to add prefix to specific post

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

    and i modified it to be “Updated” prefix

    function add_suffix($title) {
    	if( in_category( 'updated' ) ) $title =  $title . '<span class="updated">' . 'Updated'. '</span>';
    	return $title;
    }
    add_filter('the_title', 'add_suffix');

    but there is something went wrong

    see results

    https://imageshack.us/a/img832/5118/ccnplessonsonlinearabic.png

    Thanks in advance ??

Viewing 4 replies - 16 through 19 (of 19 total)
  • You’re having in issue in your actual posts too. The string ‘Updated” />’ appears above the header.

    Also, in your source code, there’s an enormous amount of caching data parsed in your footer. I’m guessing you’ve switched a debug option on in your w3c caching plugin. You might want to fix that.

    Thread Starter Muhammad Mohsen

    (@mo7sin)

    Works great ??
    i’m really shy to ask again

    i got unnecessary “Updated” inside the post

    https://ccnplessons.com/frame-relay/

    Thanks in advance.

    unfortunately, the filter on ‘the_title’ is not very specific;

    you might need to attack that using css;

    try for example:

    .updated { display: none; }
    
    .cover .updated, h1 .updated { display: block; }
    Thread Starter Muhammad Mohsen

    (@mo7sin)

    It works .. thank you very much ??

Viewing 4 replies - 16 through 19 (of 19 total)
  • The topic ‘Add prefix to specific post’ is closed to new replies.