Archived topic
Post Header Links
24 replies · Started by Anonymous on August 11, 2015
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
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 :)
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
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 :)
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!!!
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 :)
awesome thanks a lot!
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 :)
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
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 :)
ohh man I followed the guide to install the child theme and now my menu is all different (haven't added in the code)
Actually I fixed it! I just had to turn them on in the manage locations section in appearance > menu.
Ah yea, changing themes can result in that - glad you sorted it out :)
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
What version of GP Premium are you running?
