make home block text clickable
URL to the page in question:
http://www.vilhelmstokstad.com
-
Hi,
Is there a way to make the titels and text on the home blocks do the same thing as the little button in the corner; open a slideshow? I think this would make the site a lot more user friendly, especially on mobile.
Thanks
Hello Vilhelm,
Good question there. You can set the text in the home block to open up the gallery lightbox. Here’s how:
- Go to the Appearance section in your WordPress dashboard and choose Edit.
- From the list of files on your right, choose page-home-template.php
- Find this spot:
<?php echo apply_filters('the_content', get_post_meta($post->ID, 'hero_content', true)); ?>
- Change that line to this:
(Be sure to copy that code directly from the support site and not the notification email).
- Save your changes.
That will turn all the text in your home blocks into a link that will open up your galleries. The only catch is you won’t be able to place links inside your text anymore.
If you have any questions or trouble, let me know.
Thanks,
Bill
Works like a charm, thanks! Is it possible to exclude a single home block from this? or is that a hassle?
Also this doesn’t seem to work when i am viewing just the blocks in a portfolio category, it only affects the absolute homepage.
thanks again!
Vilhelm,
I’m glad that worked out. You can add it to the categories too by making the same edit to the taxonomy-portfolio-group.php file too. That will bring the change there as well.
Practically removing the link from a specific one would be a bit of trouble. You could use a conditional statement if you want to give it a shot. It would change the snippet above to something like this:
(Again copy that code directly from the support site and not the notification email)
You’ll want to change the first line there where it says Block Name
to the name (title) of the block you’d like to keep from being clickable and that should exclude it.
If you run into trouble, let me know.
Thanks,
Bill
Hi Bill,
I didn’t get the last piece to work, it seems to still affect all of the home blocks, so that none of the links work instead. quick solve: made the first block an image with text instead of actual text.
Another thing, the first peace of code, that makes the text clickable, seems to affect the actual slideshow. The first image shows twice when I’m using the text link, but not when using the “+”-button.
Sorry for the hassle! Thanks for all the help, really appreciate it!
Regards Vilhelm
Vilhelm,
It most likely will show the first one twice. We’re creating a new link to open up the slideshow and it’s adding that link to the loop of the gallery. There may not be a way around that. Sorry about that.
Bill
- The topic ‘make home block text clickable’ is closed to new replies.