• Resolved chaneswin

    (@chaneswin)


    Hi,
    I use this plugin to add a default featured image and use other plugin to add post title covered on featured image. However post title not work if default featured image automatically applied. How can I fix it?

    Not knowing if its helpful but below is part of code from other plugin:

    function splitTitle($title) {
        $titles = explode(",", $title); 
        if(count($titles)>1)
            return "{$titles[0]} <br/> {$titles[1]}";
        else
            return $title;
    }
    
    // add post title
    function testFilter($html){
        global $post;
        return '<div class="feature-parent">' . $html . '<p class="feature-title">' . splitTitle(get_the_title()) . '</p></div>';
    }
    add_filter( 'post_thumbnail_html', 'testFilter');
    //add css

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

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

    (@janwoostendorp)

    Hello,

    sorry for the late reply.
    What you say is true and easy to fix.
    DFI also uses the post_thumbnail_html filter. But it goes after yours and overrides it.

    The fix is to give your filter a lower priority:

    add_filter( 'post_thumbnail_html', 'testFilter', 25);

    Let me know how it goes.
    Jan-Willem

    Thread Starter chaneswin

    (@chaneswin)

    Thank you so much!
    It fixed.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Other plugin cannot show post title on featured image’ is closed to new replies.