Support » Plugins » Hacks » Open portfolio in a new tab.

  • Hello, Does any one knows how to open portfolio post in a new tab?
    the post and the port folio post are different from each other.Though they work same. Used many plug in but not working as there’s a hover effect on the thumbnail. As i am no good in code, i give you my .php files. please tell me where to put target=”_blank” . thanks
    —————-single-portfolio.php———————-

    <?php get_template_part('templates/page', 'header_work'); ?>
    
    <div class="row">
      <div id="portfolio-page" class="clearing-container">
          <?php get_template_part('templates/portfolio', 'single'); ?>
      </div>
    </div>

    ————————page.php——————–

    <?php
    
        get_template_part('templates/page', 'header');
    
        ?>
    
    <div class="row">
    
        <?php
        if(!is_front_page()) {
            set_layout('pages');
        } else {
            echo '<div id = "content" class = "fifteen columns" ><div class = "row" >';
        }
    
        get_template_part('templates/content', 'page');
    
        echo '</div>';
    
        if(!is_front_page()){
            set_layout('pages', false);
        } else {
            echo '</div></div>';
        }
    
        ?>
    
    </div>

    ——————–single.php————————-

    <?php get_template_part('templates/page', 'header'); ?>
    
    <div class="row">
    
        <?php
        $post_display = get_post_meta($post->ID, 'full_width_post', true);  ;
    
        if( !$post_display || $post_display == 'default' ) {
            set_layout('single', true);
        } else {
            if (($post_display == "2c-l-fixed") || ($post_display == "3c-fixed") || ($post_display == "3c-l-fixed")) {
                get_template_part('templates/sidebar', 'left');
            }
            if ($post_display == "3c-l-fixed"){
                get_template_part('templates/sidebar', 'right');
            }
    
            if (($post_display == "2c-l-fixed") || ($post_display == "2c-r-fixed")) {
                echo '<div id="content" class="eleven columns">';
            } elseif (($post_display == "1col-fixed")) {
                echo '<div id="content" class="fifteen columns">';
            } else {
                echo '<div id="content" class="seven columns">';
            }
        }
    
        get_template_part('templates/content', 'single');
    
        if( !$post_display || $post_display == 'default' ) {
            set_layout('single', false);
        } else {
            if ($post_display == "3c-r-fixed") {
                get_template_part('templates/sidebar', 'left');
            }
            if (($post_display == "2c-r-fixed") || ($post_display == "3c-fixed") || ($post_display == "3c-r-fixed")) {
                get_template_part('templates/sidebar', 'right');
            }
        }
        ?>
    </div>

    —————————–functions.php————————

    <?php
    /**
     * Roots functions
     */
    
    if (!defined('__DIR__')) { define('__DIR__', dirname(__FILE__)); }
    
    require_once locate_template('/inc/includes.php');   
    
    function roots_setup() {
    
      // Make theme available for translation
      load_theme_textdomain('roots', get_template_directory() . '/lang');
    
      // Register wp_nav_menu() menus (http://codex.wordpress.org/Function_Reference/register_nav_menus)
      register_nav_menus(array(
        'primary_navigation' => __('Primary Navigation', 'roots'),
      ));
    
      // Add post thumbnails (http://codex.wordpress.org/Post_Thumbnails)
      add_theme_support('post-thumbnails');
    
      // Add post formats (http://codex.wordpress.org/Post_Formats)
      add_theme_support('post-formats', array('gallery', 'link', 'image', 'quote', 'video', 'audio'));
    
      // Tell the TinyMCE editor to use a custom stylesheet
      add_editor_style('assets/css/editor-style.css');
    
    }
    
    add_action('after_setup_theme', 'roots_setup');
    
    add_post_type_support('page', 'excerpt');
    
    add_action( 'admin_notices', 'is_options_css_writable' );
    function is_options_css_writable(){
        if( !is_writable( locate_template('/css/options.css') ) )
            echo '<div class="updated"><p>css/options.css rights is not enough</p></div>';
    }
    
    add_filter( 'the_category', 'add_nofollow_cat' );
    function add_nofollow_cat( $text ) {
        $text = str_replace('rel="category tag"', "", $text); return $text;
    }
    
    add_filter('widget_text', 'do_shortcode');
    
    function limit_words($string, $word_limit) {
    
        // creates an array of words from $string (this will be our excerpt)
        // explode divides the excerpt up by using a space character
    
        $words = explode(' ', $string);
    
        // this next bit chops the $words array and sticks it back together
        // starting at the first word '0' and ending at the $word_limit
        // the $word_limit which is passed in the function will be the number
        // of words we want to use
        // implode glues the chopped up array back together using a space character
    
        return implode(' ', array_slice($words, 0, $word_limit));
    
    }
    
    add_filter( 'wp_get_attachment_image', 'remove_thumbnail_dimensions', 10 );
    add_filter( 'image_send_to_editor', 'remove_thumbnail_dimensions', 10 );
    
    function remove_thumbnail_dimensions( $html ) {
        $html = preg_replace( '/(width|height)=\"\d*\"\s/', "", $html );
        return $html;
    }
    
    // show admin bar only for admins
    if (!current_user_can('manage_options')) {
        add_filter('show_admin_bar', '__return_false');
    }
    // show admin bar only for admins and editors
    if (!current_user_can('edit_posts')) {
        add_filter('show_admin_bar', '__return_false');
    }
    
    function template_admin_head(){
        echo '<script>template_uri = "'.get_template_directory_uri().'";</script>';
        echo '<script>base_url = "'.home_url().'";</script>';
    }
    add_action('admin_head', 'template_admin_head');

    —————-content-single.php—————————-

    <?php
    global $NHP_Options;
    
    if (!have_posts()) : ?>
      <div class="alert alert-block fade in">
        <p><?php _e('Sorry, no results were found.', 'roots'); ?></p>
      </div>
        <?php get_search_form(); ?>
    <?php endif; ?>
    
    <?php while (have_posts()) : the_post(); ?>
    
    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    
        <?php
        global $NHP_Options;
        if( $NHP_Options->get("post_inner_header") == '1'){
    
        echo '<header style = "margin-left: 0; min-height: auto">';
            get_template_part('templates/entry-meta','single');
        echo '</header>';
        }
    
        if( $NHP_Options->get("post_share_button") && (($NHP_Options->get("post_share_place") == 'top' )|| ($NHP_Options->get("post_share_place") == 'both' ))) { ?>
    
            <?php get_template_part('/templates/social', 'share'); ?>
    
            <?php  }
    
        if ($NHP_Options->get("thumb_inner_disp") == '1') {
            if (has_post_thumbnail()) {
                $thumb = get_post_thumbnail_id();
                $img_url = wp_get_attachment_url($thumb, 'full'); //get img URL
                if ($NHP_Options->get('post_thumbnails_width') != '' && $NHP_Options->get('post_thumbnails_height') != '') {
                    $article_image = aq_resize($img_url, $NHP_Options->get('post_thumbnails_width'), $NHP_Options->get('post_thumbnails_height'), true);
                } else {
                    $article_image = aq_resize($img_url, 1200, 500, true);
                }
                ?>
                <div class="entry-thumb">
                    <a href="<?php the_permalink(); ?>"><img src="<?php echo $article_image ?>"  alt="<?php the_title(); ?>"/></a>
                </div>
                <?php
            }
        }
        ?>
    
        <div class="entry-content">
    
        <?php if (has_post_format('video')) {
    
            get_template_part('templates/single-post', 'video');
        }?>
    
            <?php the_content(); ?>
    
        </div>
    
      </article>
    <?php    if( $NHP_Options->get("autor_box_disp") =='1'){
    
            get_template_part('/templates/author', 'box');
    
        }
        if( $NHP_Options->get("post_share_button") && (($NHP_Options->get("post_share_place") == 'bottom' )|| ($NHP_Options->get("post_share_place") == 'both' ))) {
    
            get_template_part('/templates/social', 'share');
    
          }
    
        endwhile;  comments_template('/templates/comments.php'); ?>
    
    </div>

Viewing 15 replies - 1 through 15 (of 20 total)
Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘Open portfolio in a new tab.’ is closed to new replies.