• Resolved sudoranger

    (@sudoranger)


    Hello. I’ve read your FAQ but I can’t get it to work. When I share on Telegram, it only displays the link and nothing else. I’ve refresh the cache (update preview with content) using @webpagebot

    add_filter('og_og_title_meta', 'my_og_og_title_meta');
    function my_og_og_title_meta($title)
    {
        if ( is_home() ) {
            return '<meta property="og:title" content="XXX" />';
        }
        return $title;
    }
    
    add_filter('og_image_init', 'my_og_image_init');
    function my_og_image_init($images)
    {
        if ( is_front_page() || is_home() ) {
            $images[] = 'XXX';
        }
        return $images;
    }

    Other posts are okay, I only have a problem for my home page which doesn’t show anything. Thanks in advance!

Viewing 1 replies (of 1 total)
  • Thread Starter sudoranger

    (@sudoranger)

    Nevermind! I figured and got it working.

    add_filter('og_og_title_value', 'my_og_og_title_value');
    function my_og_og_title_value($title)
    {
        if ( is_home() ) {
            return __('This is extra home title!', 'translate-domain');
        }
        return $title;
    }

    I’m not sure why the previous filters didn’t work though! But at least now the preview is working as expected.

    • This reply was modified 5 years ago by sudoranger.
Viewing 1 replies (of 1 total)
  • The topic ‘Front/Home Page (Latest Posts) with Title + Description + Image’ is closed to new replies.