• Resolved fgoellner

    (@friederun-goellner)


    Hi,
    for a news blog we had to add a second title field and decided for KIA subtitle. But since relaunch, titles without subtitles (german: Dachzeile or header line) do not always make sense. That means, we have to include this subtitle to the rss feed respectively the xml <title></title> tag preferably just before title. I did not find any filter doing just this and I don’t want to add or edit any SEO plugin. Can you help me?

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author HelgaTheViking

    (@helgatheviking)

    based on this tutorial: https://techbrij.com/wordpress-customize-rss-feed-title

    the following may work:

    
    /**
     * Add subtitle to rss title
     *
     * @param string $title the post title
     * @return string
     */
     function kia_feed_subtitle( $title ) {
        if ( function_exists( 'get_the_subtitle' ) ) {
            $subtitle = get_the_subtitle( get_the_ID() );
            if ( $subtitle ) {
                $title = $subtitle . ' - ' . $title;
            }
        }
        return $title;
    }
    add_filter( 'the_title_rss', 'kia_feed_subtitle' );

    `

    totally untested, but if that’s the right filter name it should push you in the right direction.

    Thread Starter fgoellner

    (@friederun-goellner)

    Thank you very much. That is exactly what I was looking for.
    Actually I would recommend you to add it to your Plugin Description. If subtitle is used it should always be included to rss feed, I think.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to add subtitle to rss feed’ is closed to new replies.