• On this section of my site https://www.ilweb360.com/#googleview when I click on each image I get a zoom icon and a gallery of all images.

    While I need to change it in this way:
    each image must have a title and an external link. When I move the mouse over it I’ll be able to see image title and then click on it and go to external link on a _blank page.

    Now I have this function for it:

    /**
    * Portfolio
    *
    */

    if ( !function_exists(‘shortcode_portfolio’) ) {
    function shortcode_portfolio( $args ) {

    extract( shortcode_atts( array(
    ‘posts_count’ => -1,
    ‘columns’ => 5,
    ‘filter’ => ‘false’,
    ‘custom_class’ => ”,
    ), $args) );

    $posts_count = intval( $posts_count );

    $output = ‘<div class=”portfolio-shortcode ‘.$custom_class.'”>’;

    if($filter == ‘true’){
    $output .= ‘<div class=”portfolio_filter_buttons”>’;
    $output .= ‘<div class=”filter_button current-category” data-filter=”*”>All</div>’;
    $terms = get_terms(‘portfolio_category’);
    foreach ( $terms as $term ) {
    $output .= ‘<div class=”filter_button” data-filter=”‘.$term->slug.'”>’.$term->name.'</div>’;
    }
    $output .= ‘</div>’;
    }

    // WP_Query arguments
    $args = array(
    ‘posts_per_page’ => $posts_count,
    ‘post_type’ => ‘portfolio’
    );

    // The Query
    $portfolio_query = new WP_Query( $args );

    $output .= ‘<div class=”portfolio_wrapper” data-columns=”‘.$columns.'”>’;
    if ( $portfolio_query->have_posts()) :
    $index = 1;
    while ( $portfolio_query->have_posts() ) : $portfolio_query->the_post();
    $post_id = $portfolio_query->post->ID;

    $post_categories = wp_get_post_terms( $post_id, ‘portfolio_category’ );
    $post_categories_name = ”;

    foreach($post_categories as $c){
    $post_categories_name .= ‘ ‘ .$c->slug;
    }

    if ( has_post_thumbnail( $post_id ) ) {
    $output .= ‘<div class=”portfolio-item portfolio-item-‘.$index.’ ‘.$post_categories_name.'”>’;
    $output .= ‘<figure class=”thumbnail”>’;
    $attachment_url = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), ‘full’ );
    $url = $attachment_url[‘0’];
    $image = aq_resize($url, 410, 310, true);

    $output .= ‘‘;
    $output .= ‘<div class=”enlarge-icon”></div>’;
    $output .= ‘<img src=”‘.$image.'” alt=”” />’;
    $output .= ‘
    ‘;
    $output .= ‘</figure>’;
    $output .= ‘</div>’;

    $index++;
    }
    endwhile;
    endif;
    $output .= ‘</div>’;

    $output .= ‘</div>’;

    wp_reset_postdata();

    return $output;
    }
    add_shortcode( ‘portfolio’, ‘shortcode_portfolio’ );
    }

    How may I change it to get my custom function?
    I’m not a developer, I know basic php, so I need help to do it.
    Thank you

  • The topic ‘add title and external link instead of zoom on a portfolio’ is closed to new replies.