[Resolved] Different logo and link to my blog page and single post

Home Forums Support [Resolved] Different logo and link to my blog page and single post

Home Forums Support Different logo and link to my blog page and single post

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #2184767
    Feber

    Hi there,

    I have made an element for my blog and single page logo. It works.
    I have 2 different logos. 1 for my pages and the other for blogs+single post.
    But both logos linked to my homepage.

    I want the logo for my blog and single post linked to my blog page.

    How to do that ?
    If it in PHP, where can I put the code ? Is it in functions.php or how to do it easily ?

    Thanks

    #2184887
    David
    Staff
    Customer Support

    Hi there,

    Try this:

    1. The logo you use on your Posts and Blog should be the one set in the Customizer > Site Identity.

    2. Use the Header Element to change the logo for your pages.

    3. you can use this PHP Snippet to change the default logos URL when viewed on a single post:

    add_filter( 'generate_logo_href', function($url) {
        if ( is_single() ) {
            $url = "your_blog_page_URL";
        }
        return $url;
    } );

    change the your_blog_page_URL to your sites blog url

    #2185222
    Feber

    hi there,

    it’s not working.

    anything wrong from my side ?

    #2185291
    David
    Staff
    Customer Support

    Try:

    add_filter( 'generate_logo_href', function($url) {
        if ( is_single() ) {
            $url = "your_blog_page_URL";
        }
        return $url;
    }, 99, 1 );
    #2185397
    Feber

    not working. still the same

    #2185430
    Leo
    Staff
    Customer Support

    Can you clear and disable your caching plugin first?

    Let me know ๐Ÿ™‚

    #2186837
    Feber

    I dit. But nothing change

    #2186893
    Ying
    Staff
    Customer Support

    Hi Feber,

    Your site link doesn’t work on my end, I just tested the code and it worked well.

    How did you add the code?

    And can you disable all plugins except GP premium and the plugin you added PHP code with to eliminate plugin conflicts?

    #2186907
    Feber

    I use 2 different php snippet plugin. stil nothing change.

    #2186908
    Feber

    now it works in single post.
    but not in blog.

    #2186916
    Ying
    Staff
    Customer Support

    Oh I see, you want single post pages and blog page use the same URL?

    If so, try this code instead:

    add_filter( 'generate_logo_href', function($url) {
        if ( is_single() ||  is_home()  ) {
            $url = "your_custom_URL";
        }
        return $url;
    }, 99, 1 );

    Replaceyour_custom_URL with your URL.

    #2186921
    Feber

    yeahhh…. thank you so much.
    it works. thank you

    #2187881
    Ying
    Staff
    Customer Support

    No problem ๐Ÿ™‚

Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.