Support » Plugin: WordPress Picture / Portfolio / Media Gallery » Thumnail click to Portfolio URL not Permalink or Lightbox

  • Resolved becrrw

    (@becrrw)


    Hi,

    Please could you help me to link my thumbnails to their portfolio URLs not to the permalinks and not to the lightbox.

    My portfolio is not under mywebaddress.co.uk/portfolio instead it is at mywebaddress.co.uk/projects

    The permalinks for each project I have uploaded shows as being mywebaddress.co.uk/portfolio but the Portfolio URLs down the bottom I have entered as mywebaddress.co.uk/projects/projectname

    I have tried editing my themes functions.php file to include this at the bottom –

    add_filter(‘nimble_portfolio_posttype_slug’, ‘handle_nimble_portfolio_posttype_slug’);

    function handle_nimble_portfolio_posttype_slug($slug) {
    return “projects”;
    }

    Nothing changed.

    I have tried tinkering in the items.php file and I figured out how to disable the lightbox and remove the hover icon but I just can’t suss what I want to do which is keep the hover icon and have each thumbnail link to a page which is located at the portfolio url.

    Thanks very much

    https://wordpress.org/plugins/nimble-portfolio/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Amazing, I’ve battled with this for weeks then I finally post and the person’s post below mine enabled me to solve it! haha

    For anyone else struggling to do the same, for me the solution was to use the same code as my view project link below my thumbnails to link to the portfolio url so this was the answer…

    Locate your items.php file in wp-content\plugins\nimble-portfolio\skins\default

    Find the code which says
    >

    and replace it with

    getData(‘nimble-portfolio-url’); ?>” class=”button-fixed”>
    <?php _e($viewproject_text, ‘nimble_portfolio_context’) ?>

    <a <?php echo NimblePortfolioPlugin::phpvar2htmlatt($item_link); ?>>

    replaced with

    <a href="<?php echo $item->getData('nimble-portfolio-url'); ?>" class="button-fixed">
                                <?php _e($viewproject_text, 'nimble_portfolio_context') ?>

    This is a proper way disable lightbox or permalinks

    // To disable lightbox on nimble portfolio
    add_filter('nimble_portfolio_lightbox_link_atts', 'handle_nimble_portfolio_lightbox_link_atts', 20, 2);
    function handle_nimble_portfolio_lightbox_link_atts($link_atts, $item) {
    unset($link_atts['rel']);
    return $link_atts;
    }

    If you want to use permalink then copy this code in functions.php of your theme

    // To use permalink on nimble portfolio
    add_filter('nimble_portfolio_lightbox_link_atts', 'handle_nimble_portfolio_lightbox_link_atts', 20, 2);
    function handle_nimble_portfolio_lightbox_link_atts($link_atts, $item) {
    $link_atts['href'] = $item->getPermalink();
    unset($link_atts['rel']);
    return $link_atts;
    }

    If you want to use Protfolio URL then copy this code in functions.php of your theme

    // To use Protfolio URL on nimble portfolio
    add_filter('nimble_portfolio_lightbox_link_atts', 'handle_nimble_portfolio_lightbox_link_atts', 20, 2);
    function handle_nimble_portfolio_lightbox_link_atts($link_atts, $item) {
    $link_atts['href'] = $item->getData('nimble-portfolio-url');
    unset($link_atts['rel']);
    return $link_atts;
    }

    Thanks junaidbhatti. I just restored my original items.php file and pasted your bottom code into the very bottom of my functions.php file and tried clicking my portfolio thumbnails and they just behaved as they did originally – opening up lightbox.

    I also tried pasting in the top section of code to disable the lightbox as well as the bottom section of code directly underneath it in my functions.php file to make the thumbnails links to the portfolio url and still it just opened up the lightbox when I tested it.

    Plugin Author Nimble3

    (@nimble3)

    @becrrw are you using a child theme?

    If you want to customize items.php then use this method instead http://demo.nimble3.com/nimble-portfolio/customize-a-nimble-portfolio-skin-from-theme/ Its an upgrade safe way.

    I just updated the plugin and as you had pointed out in that last post – it wasn’t upgrade safe! I ended up with my thumbnails linking back to lightbox again. I just had a go at following the instructions on the link you gave but I didn’t have much luck so for the moment I’ve just uploaded my backup of my item.php into the default skin again to fix it.

    Could you please tell me what I’m doing wrong with creating my own skin? I created a new folder in wp-content/plugins/nimble-portfolio/skins so I now have 2 folders showing – default and newfolder. I then pasted my backup of how I want my items.php to work into newfolder so it just has that one file inside and nothing else. I then logged out of wordpress and back in and clicked nimble portfolio on the left but the drop down menu still shows just Skin: default at the bottom of the menu and not my new skin.

    Thanks

    Re linking to the portfolio URL using
    // To use Protfolio URL on nimble portfolio
    add_filter(‘nimble_portfolio_lightbox_link_atts’, ‘handle_nimble_portfolio_lightbox_link_atts’, 20, 2);
    function handle_nimble_portfolio_lightbox_link_atts($link_atts, $item) {
    $link_atts[‘href’] = $item->getData(‘nimble-portfolio-url’);
    unset($link_atts[‘rel’]);
    return $link_atts;
    }

    What’s the best way to make those links open in a new window?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Thumnail click to Portfolio URL not Permalink or Lightbox’ is closed to new replies.