-
AuthorPosts
-
June 18, 2020 at 1:38 pm #1223696
Hi,
I want to add a shortcode to block external media to the “Link portfolio item to external URL” to load. Right now if I put a Youtube link to that, it will pop up in an iframe and will display the video directly.
What I want to do is to put a shortcode like this: [borlabs-cookie id=”youtube” type=”content-blocker”]URL[/borlabs-cookie] so it will display a content blocker if they haven’t agreed to the privacy settings in the beginning. Reference on how it looks like is here: https://borlabs.io/borlabs-cookie/iframe-demo/
If I add the shortcode directly there, the youtube video will not load at all.
Could you help me with this?
Best,
IndraJune 25, 2020 at 11:36 am #1225453Hey forgottensky,
Thank you for the inquiry.
We are not really sure how the borlabs content block works but you can add an overlay above the portfolio item using a filter. Maybe you can create a script that removes the overlay when the user opt in to play the video or click the button in the overlay.
You can add this in the functions.php file:
add_filter('avf_portfolio_custom_overlay', function($overlay, $entry) { $id = $entry->ID; $custom_link = get_post_meta( $id, '_portfolio_custom_link', true ) != '' ? get_post_meta( $id, '_portfolio_custom_link_url', true ) : false; if($custom_link) { $overlay .= "<div class='grid-entry-privacy-overlay'><span>You shall not pass!<span></div>"; } return $overlay; }, 10, 2);
.. then use this css code to style the overlay a bit:
.grid-entry-privacy-overlay { display: table; position: absolute; text-align: center; width: 100%; height: 100%; background: rgba(0,0,0,0.3); } .grid-entry-privacy-overlay span { display: table-cell; vertical-align: middle; color: #ffffff; font-size: 2em; }
You can also try and add the borlabs shortcode as the output of the overlay filter.
Best regards,
IsmaelJune 29, 2020 at 6:20 pm #1226541Hi Ismael,
thanks for your reply! I tried your solution but it doesn’t really work in my context. Putting the shortcode as the output of the overlay didn’t work out as it throws out a lot of compiler error. I may try different methods but this is turning out more complicated than I thought.
Thanks again for your time and help.
Best,
IndraJuly 3, 2020 at 7:51 am #1227687Hi,
What does the shortcode returns or renders when you add or embed it in a page? Did you wrap it in a do_shortcode function?
// https://developer.wordpress.org/reference/functions/do_shortcode/
What errors were thrown when you included the shortcode in the overlay? Please post it pastebin.com so that we can check it.
Thank you for your patience.
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.