Want to open Shadowbox gallery directly through WordPress Navigation Menu

I want to be able to open my shadowbox gallery in wordpress by directly clicking the portfolio link in the navbar. Right now it either opens the portfolio page I made with the gallery in it or opens images separately (without shadowbox), this was because I tried adding html to the Nav Label in the wordpress dashboard. Basically want to be able to add this html to the link in the menu dashboard while having the one PORTFOLIO link:

<a href="/portfolio_images/fashion/01.jpg" rel="shadowbox[fashion]">
<a href="/portfolio_images/fashion/02.jpg" rel="shadowbox[fashion]"> 
<a href="/portfolio_images/fashion/03.jpg" rel="shadowbox[fashion]">

Thanks

Read More

Main page with nav links

Related posts

Leave a Reply

1 comment

  1. Finally figured this one out. Here is how I did it with the theme I used.

    In the Menu settings of the WordPress dashboard make sure that Link Relationships (XFN) under Screen Options is checked. I then added a custom URL menu Item with this as the URL (for my example): http://www.e-comstudio.com/portfolio_images/fashion/01.jpg

    Then, I added shadowbox[fashion] in the XFN box.

    I also added the other images in the gallery into a widget that was used on the page:

    <a href="/portfolio_images/fashion/02.jpg" rel="shadowbox[fashion]"></a>
    <a href="/portfolio_images/fashion/03.jpg" rel="shadowbox[fashion]"></a>
    

    You also have to prevent WordPress from stripping the [ ] brackets from the XFN field, which can be done by commenting out/removing this line from wp-includes/nav-menu.php

    $args[‘menu-item-xfn’] = implode( ‘ ‘, array_map( ‘sanitize_html_class’, explode( ‘ ‘, $args[‘menu-item-xfn’] ) ) );

    Might not have been the most ideal way of doing this, but it did the trick!

    You can see the finished result here, click Portfolio:

    http://www.e-comstudio.com/