[Resolved] Post Header Links

Home Forums Support [Resolved] Post Header Links

Home Forums Support Post Header Links

Viewing 15 posts - 1 through 15 (of 25 total)
  • Author
    Posts
  • #128489
    Tristan

    Hey Tom,

    Me again… have been working on my site overnight: tristancossins.com
    What I have been using is the feature image if I just want people to go to that post (e.g if I’m just displaying a photo or something). If I want to show a video I’ve been using the page header function which let’s me put in a custom link… so I’ve been using video thumbnails with a play icon on them and then I can link them to that. (I played around with feature video plugin but it messed up padding etc).

    My question is can I get the header links to open in a new tab?
    Or can I disable the header links altogether and just have the post title link to posts and put links in the text area if I want to link a video (where I can add the target=blank html).

    Hope this is making sense.

    Thanks a lot

    Tristan

    #128533
    Tom
    Lead Developer
    Lead Developer

    Hi Tristan,

    By header links, do you mean the post title link to the full post? Or the post image link? Should be able to come up with a function for you to remove the link from the post image if that’s what you’re after πŸ™‚

    #128541
    Tristan

    Yeh, so the way i’ve set it up on the main blog page is have an image at the top and then the post below.
    I wanted some of those pics to link to a video page in a new tab but I dont know if I can do this… an alternative would be to remove the image links and just have the link in the post. Hope i’m making sense, if it involves anything other than adding in some css I may need a bit of a noob guide.

    Thanks heaps

    #128556
    Tom
    Lead Developer
    Lead Developer

    If you’re using the “Page Header” metabox to add your featured image, there’s a “Page Header Link” option below where you upload the image in the “Image” tab.

    Currently, that’s the only way to specify a custom URL to link to using the post image.

    If that doesn’t work, I’ll have to dig a little deeper and make it possible to remove the URL in a future version.

    Let me know πŸ™‚

    #128557
    Tristan

    Yeh i’ve been using the page header image rather than the ‘feature image’ as you can specify custom links. Is there anyway of making that link open in a new tab/window? Sorry for the hassle!!!

    #128559
    Tom
    Lead Developer
    Lead Developer

    No hassle!

    I’ll have to check in the morning. I think I’ll have to add something to the plugin to allow this – it’s a good idea.

    Will get back to you πŸ™‚

    #128560
    Tristan

    awesome thanks a lot!

    #128751
    Tom
    Lead Developer
    Lead Developer

    Okay, this will be possible in the next version of Page Header/GP Premium:

    add_filter( 'generate_page_header_target','generate_open_page_header_new_tab' );
    function generate_open_page_header_new_tab()
    {
          return ' target="_blank"';
    }

    Adding PHP: https://generatepress.com/knowledgebase/adding-php-functions/

    Won’t work yet, but the next version should be out early next week πŸ™‚

    #128804
    Tristan

    Unreal mate thank you! When you use a child theme does it get deleted if you update the site? Or it just stays there? I’ve also got GP hooks although i don’t really know what to do with it haha

    #128858
    Tom
    Lead Developer
    Lead Developer

    The child theme stays there untouched. The parent theme is the one that’s replaced, which is why you shouldn’t change anything within the parent theme, or it will be lost.

    The child theme is meant for modifications as it’s never updated πŸ™‚

    #128886
    Tristan

    ohh man I followed the guide to install the child theme and now my menu is all different (haven’t added in the code)

    #128900
    Tristan

    Actually I fixed it! I just had to turn them on in the manage locations section in appearance > menu.

    #128949
    Tom
    Lead Developer
    Lead Developer

    Ah yea, changing themes can result in that – glad you sorted it out πŸ™‚

    #131497
    Tristan

    Hey guys,

    Just a query with the new pageheader update… I have a few page header images with custom links and the following code in my child theme’s functions.php file:

    add_filter( 'generate_page_header_target','generate_open_page_header_new_tab' );
    function generate_open_page_header_new_tab()
    {
          return ' target="_blank"';
    }

    but they don’t seem to be opening in new tabs. Any ideas?

    Thanks

    #131533
    Tom
    Lead Developer
    Lead Developer

    What version of GP Premium are you running?

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