Responsive WordPress Theme – Caliber

A theme with simple controls and limitless potential. Work fast and build an amazing website!   Find out more »

UpThemes – Beautiful WordPress Themes

Create a site your church, gallery, newspaper, blog, recipes, band and more!   See the themes »

Need a little help?  Find answers quickly by searching the forum.
Group Admins
  • jeffw
  • andy

Support for: Mingle – Multi-purpose WordPress Theme

Mingle (WordPress)

Public Group  |  active 7 months ago ago
Viewing post 1 to 15 (20 total posts)

Linking a portfolio item to another website

  • byroncov

    said

    Is it possible to link a portfolio item to a URL not located within the site? When the user clicks on the thumbnail, I want the user to go straight to the URL address. The shortcode only lets me do lightbox or blogpost.

  • andy

    said

    I’ve previously described a method for this with the Salutation theme. These themes are very similar in this area so the instructions should be similar if not exactly the same. Below are the instructions I gave for Salutation. To avoid confusion I have removed any line numbers or other theme specific references that may be incorrect. This may require some minor differences but the concept is the same.

    Here is a little trick you can do. Open the file “template-portfolio.php” and you’ll find code that resembles this:

    // linking
    $title = get_the_title(); // if media Title entered
    $class = '';
    switch (strtolower(trim($sc['link']))) {
      case 'none':
        $URL = '';
        break;
      case 'post':
        $URL = get_permalink();
        break;
      case 'lightbox':
      default:
        $URL = wp_get_attachment_url($thumb); // original image
        if (get_meta('media_url')) $URL = get_meta('media_url'); // if media URL entered
        if (get_meta('media_title')) $title = get_meta('media_title'); // if media Title entered
        $class .= 'popup';
    }

    You can edit this code by adding an additional “case” for “new” which should go just after “none” case and before the “post” case with the code shown below:

      case 'new':
        $URL = wp_get_attachment_url($thumb); // original image
        if (get_meta('media_url')) $URL = get_meta('media_url'); // if media URL entered
        if (get_meta('media_title')) $title = get_meta('media_title'); // if media Title entered
        break;

    Now you can get links to open in a new window by inserting your URL into the “Media” box from the “URL” field of your page/post edit screen. This is where you would normally enter the video link.

    To trigger the shortcode to use the external link from the Medai field, set the “link” parameter to “new” as shown below:

    [portfolio category="7" columns="4" content_width="926" image_ratio="4:3" link="new"]

    This will open the link of the Media URL field for each of your portfolio items when they click the image or title.

  • byroncov

    said

    How do I get it to open in another window or tab?

  • Steve

    said

    Hi @byroncov,

    Andy has explained this above?

    Now you can get links to open in a new window by [...]

  • byroncov

    said

    Yeah it goes to the site, but it doesn’t open in a new window or tab. It just goes to the page in the same window.

  • andy

    said

    @byroncov

    Did you make all of the changes and include the additional parameter in your shortcode, link="new"?

    [portfolio category="7" columns="4" content_width="926" image_ratio="4:3" link="new"]

  • wijaya

    said

    Thanks, this thread save my time, valuable thread.

  • pajarito

    said

    I would like to have portfolio items open to a page that I created on my site, rather than an outside url. Would the process be the same as you have outlined above, or is there another way to do this?

  • jeffw

    said

    @pajarito If you don’t want a click on a portfolio thumbnail to open the portfolio item post or the portfolio image, then you can enter the address of any web page into the URL box in the Media Options metabox and then clicking on the thumbnail will open that URL. Andy’s modification tips above are for if you want to open that URL in a new browser window or tab.

  • brianrutherford

    said

    I have tried the above but for a portfolio based on a porfolio made up of numbered pages and it doesn’t work. I’ve noticed that different code works differently depending on whether you are pulling from a category or list of pages. could this be my problem here do you think and if so do you have any suggestions as to how I can resolve it.

  • jeffw

    said

    Hi, brianrutherford.

    Apologies, I am not clear about what it is you are referring to by “the above”. If you can please explain in more detail and perhaps provide a link to a page that exhibits the behaviour you mention then I’ll do my best to help.

  • brianrutherford

    said

    Hi Jeffw,
    the link is “http://tempsite.root2shoot.com/tempsite/?page_id=108″. I am trying to get the images within the portfolio to link to their corresponding websites, opening as a separate web page. I added the case …new code that Andy detailed above but I still can’t get the link to work. I am probably doing something really daft but would very much appreciate your help. Thanks

  • jeffw

    said

    Hi, brianrutherford.

    I don’t see anywhere on your example page where the [portfolio] shortcode has been used. Looks like the main content on that page is being produced with the [blog] shortcode.

  • brianrutherford

    said

    I’ve tried so many different ways that, you are of course correct, it was at that point a blog post. I have now uploaded blog and portfolio shortcodes and the “new” code doesn’t work in the portfolio either, so my question is how do I fix the code so that when I click on the logo/image it takes me to an external website, in a new window.

Viewing post 1 to 15 (20 total posts)
Topic tags: portfolio