- This topic has 24 replies, 4 voices, and was last updated 8 years, 7 months ago by bdbrown.
-
AuthorPosts
-
August 11, 2015 at 5:27 pm #128489Tristan
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
August 11, 2015 at 11:19 pm #128533TomLead DeveloperLead DeveloperHi 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 π
August 11, 2015 at 11:41 pm #128541TristanYeh, 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
August 12, 2015 at 12:28 am #128556TomLead DeveloperLead DeveloperIf 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 π
August 12, 2015 at 12:46 am #128557TristanYeh 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!!!
August 12, 2015 at 12:48 am #128559TomLead DeveloperLead DeveloperNo 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 π
August 12, 2015 at 12:50 am #128560Tristanawesome thanks a lot!
August 12, 2015 at 1:37 pm #128751TomLead DeveloperLead DeveloperOkay, 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 π
August 12, 2015 at 4:59 pm #128804TristanUnreal 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
August 13, 2015 at 12:11 am #128858TomLead DeveloperLead DeveloperThe 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 π
August 13, 2015 at 2:10 am #128886Tristanohh man I followed the guide to install the child theme and now my menu is all different (haven’t added in the code)
August 13, 2015 at 4:59 am #128900TristanActually I fixed it! I just had to turn them on in the manage locations section in appearance > menu.
August 13, 2015 at 8:57 am #128949TomLead DeveloperLead DeveloperAh yea, changing themes can result in that – glad you sorted it out π
August 23, 2015 at 3:56 am #131497TristanHey 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
August 23, 2015 at 9:31 am #131533TomLead DeveloperLead DeveloperWhat version of GP Premium are you running?
-
AuthorPosts
- You must be logged in to reply to this topic.