Support » Themes and Templates » Open Portfolio Link in New Window?

  • Is there a way to indicate a link on a portfolio grid should open in a new window? I don’t have an “open in new window” check box option and I can’t edit the .php files because I’m working in a multisite environment.

    Is there another way around this?

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hey there shandycat,

    Hope you’re well today!

    Editing your theme php files should be an option on multisite since all sites that have that theme active are effectively using the same theme, so you’d be able to apply changes for all sites.

    An alternative would be using jQuery and creating a mu plugin that will do that for you. To do this create a php file, when done paste the following code inside the file, save it and upload it to /wp-content/mu-plugins/ folder:

    <?php
    /*
     Plugin Name: Open links in new tab
     Version: 1.0
     Plugin URI: http://wpmudev.org/
     Description: Open portfolio links in new tab.
     Author: WPMUDev
     Author URI: http://wpmudev.org/
     Network: true
    */
    
    function custom_js(){ ?>
    <script type="text/javascript">
    	jQuery( window ).load(function(){
    		jQuery( '#menu li a').attr('target', '_blank');
    	});
    </script>
    <?php }
    
    add_action('wp_head', "custom_js");

    You can also find more info on the use of mu plugins here http://premium.wpmudev.org/manuals/wpmu-manual-2/using-mu-plugins/

    Since you didn’t provide link to your site you’ll have to replace the CSS selector (#menu li a) so it targets your portfolio links.

    Hope this helps 🙂

    Cheers,
    Bojan

    Thread Starter shandycat

    (@shandycat)

    Hi Bojan, and thanks for the quick reply!

    Perhaps I should have said “I can’t edit the .php files because I’m working in a multisite environment…that was set up by someone else who will not relinquish control, nor do I have access to the theme file locations.”

    Thanks anyway. And I’ll keep working on Mr. Controlfreak!

    Hey again shandycat,

    Thanks for the clarification, in that case I’m assuming you don’t have access to FTP at all?

    If that is the case I’m not sure if you can use the solution from above. There are plugins that allows you to add php and js from your admin but I’m not sure if they work on multisite nor I have used them before. You can find one of them here: https://wordpress.org/plugins/code-snippets/ in case you want to try it out.

    Have a great weekend 🙂

    Best regards,
    Bojan

    hello

    I am new here and this is actually my first question.

    I have a HTML template that i have successfully activated as a WordPress theme and i need help to put the broken pieces together. I want to make html slider code dynamic. Please here is my header.php code

    <!DOCTYPE HTML>
    <html>
    	<head>
    		<title><?php wp_title( '|', true, 'left'); ?></title>
    		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    		<link href="css/style.css" rel="stylesheet" type="text/css"  media="all" />
    		<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
    		<link rel="stylesheet" href="css/responsiveslides.css">
    		<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
    		<script src="js/responsiveslides.min.js"></script>
    		  <script>
    		    // You can also use "$(window).load(function() {"
    			    $(function () {
    
    			      // Slideshow 1
    			      $("#slider1").responsiveSlides({
    			        maxwidth: 1600,
    			        speed: 600
    			      });
    			});
    		  </script>
    		<?php wp_head(); ?>
    	</head>
    	<body <?php body_class(); ?>>
    		<header>
    		<!--start-wrap-->
    		<div class="wrap">
    			<!--start-header-->
    			<div class="header">
    			<!--start-top-header-->
    			<div class="top-header">
    				<div class="top-header-left">
    					<ul>
    						<li class="active"><a href="#">Home</a></li>
    						<li><a href="#">Specials</a></li>
    						<li><a href="#">Delivery</a></li>
    						<li><a href="#">Contact</a></li>
    					</ul>
    				</div>
    				<div class="top-header-right">
    					<ul>
    						<li><a href="#">CURRENCY:</a></li>
    						<li>
    							<select>
    								<option>Dollar</option>
    								<option>Euro</option>
    								<option>Pound</option>
    							</select>
    						</li>
    					</ul>
    				</div>
    				<div class="clear"> </div>
    			</div>
    			<div class="clear"> </div>
    			<div class="sub-header">
    				<div class="logo">
    					<a href="index.html"><img src="images/logo.png" title="logo" /></a>
    				</div>
    				<div class="sub-header-center">
    					<form>
    						<input type="text"><input type="submit"  value="search" />
    					</form>
    				</div>
    				<div class="sub-header-right">
    					<ul>
    						<li><a href="#">log in</a></li>
    						<li><a href="#">Your account</a></li>
    						<li><a href="#">CART: (EMPTY) <img src="images/cart.png" title="cart" /></a></li>
    					</ul>
    				</div>
    				<div class="clear"> </div>
    			</div>
    			<div class="clear"> </div>
    			<div class="top-nav">
    				<?php wp_nav_menu( array(
    						'theme_location' => 'primary',
    						'container' => false,
    						'menu_class' => 'menu'
    				) ); ?>
    			<!--end-top-header-->
    			<!--End-header-->
    			</div>
    		</header>
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Open Portfolio Link in New Window?’ is closed to new replies.