• Resolved Engrsteve007

    (@engrsteve007)


    Hi John

    Many thanks for this plugin, I must confess it is one of the most complete free plugins available out there at the moment.

    I just have a quick question. Is there a way I can get my image links to open the url in a new window. I really need to complete a new project in a week and would really appreciate it if you could kindly share any information on how to do this.

    Thank you

    Newbie Steve

    https://www.ads-software.com/plugins/arconix-portfolio/

Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Author John Gardner

    (@jgardner03)

    Hi Steve,

    I appreciate the kind words. The easiest way to get that working is through jQuery. The following should work:

    https://gist.github.com/j-gardner/9499412

    Thread Starter Engrsteve007

    (@engrsteve007)

    Hi John

    Many thanks for your prompt response.

    Can you kindly tell me how/where to include the jquery code (in the link you sent me above) into the plugin files (or any other file).

    I am new to web development and don’t know where to put it ??

    Thank you in advance

    Newbie Steve

    Plugin Author John Gardner

    (@jgardner03)

    Create a file called myscript.js and put the code at the above link into that file. Then put that file in the same directory as your theme’s style.css.

    Finally, add the following code to your theme’s functions.php file:

    add_action( 'wp_enqueue_scripts', 'my_scripts' );
    function my_scripts() {
    wp_enqueue_script( 'my-scripts', get_stylesheet_directory_uri() . 'myscript.js', array( 'jquery' );
    Thread Starter Engrsteve007

    (@engrsteve007)

    Hi John

    I have done as instructed but when I try to open my website with I receive the following error

    “Parse error: syntax error, unexpected ‘;’ in /home/content/09/12038509/html/wp-content/themes/customizr/functions.php on line 231”

    Are you able to kindly advice on this please?

    Also I noticed that in line 3 of the above code for the functions.php file it says “uri” and also there is a single “(” and “{” symbol? Should this read url?

    Thank you in advance John…your help on this is highly appreciated

    Newbie Steve

    Plugin Author John Gardner

    (@jgardner03)

    Steve,

    Yeah, I goofed that up a bit. Try the following code instead.

    add_action( 'wp_enqueue_scripts', 'my_scripts' );
    function my_scripts() {
        wp_enqueue_script( 'my-scripts', get_stylesheet_directory_uri() . '/myscript.js', array( 'jquery' ) );
    }

    Edit: Yes, “uri” is correct. See the function here: https://codex.www.ads-software.com/Function_Reference/get_stylesheet_directory_uri

    Thread Starter Engrsteve007

    (@engrsteve007)

    Hi John

    Thanks for the prompt response and the updated code.

    I have updated my functions.php file but the url still seems to be opening in the same window and not a new window.

    Are you able to kindly advice on this? Is the updated functions.php code likely to affect the myscript.js file?

    Many thanks for you unflinching support with this.

    Newbie Steve

    Plugin Author John Gardner

    (@jgardner03)

    is the site visible to the outside world? If so, could you send me a link to it?

    Thread Starter Engrsteve007

    (@engrsteve007)

    Hi John

    Yes it is and the particular page is given below.

    https://www.ishopinuk.co.uk/privacy-policy/

    Many thanks

    Newbie Steve

    Plugin Author John Gardner

    (@jgardner03)

    in the myscript.js change the a.image section to a.portfolio-image… I was looking in the wrong section of code.

    I apologize for the troubles but this should clear everything up.

    Thread Starter Engrsteve007

    (@engrsteve007)

    Hi John

    I have made all the changes, but still unable to open the image url in a new tab. Did you look at the site address above? Any idea what could be the problem?

    Please help!!!

    Many thanks
    Newbie Steve

    Plugin Author John Gardner

    (@jgardner03)

    That’s odd, it works for me. When I click the links beneath Gucci and Fendi it opens those images in new windows. Were you expecting all links, not just links to images, to open in new tabs?

    Thread Starter Engrsteve007

    (@engrsteve007)

    Hi John

    Because I have included a url in the hyper link field of the Portfolio Settings section of the Portfolio Item page and changed the drop down to external link I was expecting that when I click the image the associated hyperlink opens in a new window.

    At the moment it opens in the same window which could potentially take visitors away from my site

    Any support with resolving this will be highly appreciated.

    Many thanks
    Newbie Steve

    Plugin Author John Gardner

    (@jgardner03)

    OK, so you don’t want links to images to be the only links that open in a new window, you want all portfolio item links to open in new windows, is that correct?

    Edit: I saw you tried messing with the script a bit. If you only want external links to open in new windows, use the following jQuery line:

    jQuery( "ul.arconix-portfolio-grid a.portfolio-external" ).attr( 'target', '_blank' );
    Thread Starter Engrsteve007

    (@engrsteve007)

    Exactly John, that is what I want.

    Many thanks for your patience and understanding

    Newbie Stephen

    Thread Starter Engrsteve007

    (@engrsteve007)

    Hi John

    Sorry to bother you again on this, just wanted to kindly find out if you have any suggestion on how I can overcome this issue?

    Many thanks
    Newbie Stephen

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Opening image links in a new window’ is closed to new replies.