How can I set different title for some set of category

#359856
  • How can I set different title for some set of category

    I have music post on my website, so I want to add (Mp3 Download) to all post that fall on a this category (Music)

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hello,

    Thank you for contacting the support and bringing your concern to our attention.

    This would require logic using our filter code for this to work. You can use the following filter to set the title of your posts based on the category: https://rankmath.com/kb/filters-hooks-api-developer/#change-the-title

    You will have to modify the filter and use the conditions to make it work the way you want.

    Hope this helps. Let us know if you need any other assistance.

    Thank you, can I know the exact filters I can use and a hint?

    Hello,

    I went ahead and constructed the custom filter for you. Please refer to this filter:

    add_filter( 'rank_math/frontend/title', function( $title ) {
        if(in_category('music')){
            $title .= ' (Mp3 Download)';
        }
        return $title;
    });

    Please check if the current slug corresponds to your current “Music” category.

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Thank you sir, God bless you.
    I will implement it on the site

    It’s working, thank you

    Is showing at the back. How can I make it show after the post title

    Hello,

    This may require you to further customize the filter code I previously shared.

    The ' (Mp3 Download)' text needs to be inserted in between the post title and the separator which requires you to extend the code.

    However, this level of customization falls outside the scope of our support.

    Please do not hesitate to let us know if you need our assistance with anything else.

Viewing 7 replies - 1 through 7 (of 7 total)

You must be logged in to reply to this ticket.