badget

Biggest Sale! Special Offer!

Get 30% discount on all of our single themes with this coupon code: #30%SALE

Hurry up! *Limited time offer*

Reply To: Link gallery item til gallery custom post.

#13393

Hi Peer,

I think you don’t want this popup right ? So you need code customisation for it but We recommended not to change the code because if you change the code then while updating to our new version all your customisation code will be lost. So better make child theme and first unhook the functions and the edit the code.

http://codex.wordpress.org/Child_Themes

How to change it ?

=> first goto theme folder (interface pro) -> inc -> content-extension.php on
line number 1102 ==> for two column
line number 1214 ==> for three column and
line number 1326 ==> for four column

I think that you have used three coulmn, copy this all function to your child theme. Create functions.php on your child theme first

add_action( 'interface_gallery_three_column_template_content', 'interface_gallery_three_column_template_content', 10 );
/**
 * Displays the three column gallery content
 */
function interface_gallery_three_column_template_content() { ?>
	<div id="content">
		<ul class="gal-filter clearfix">
			<li class="active no-padding-left"><a href="javascript:void(0)" class="all" title="ALL"><?php _e('All','interface');?></a></li>/
			<?php
					// Get the taxonomy
					$terms = get_terms('gallery_category');
					
					// set a count to the amount of categories in our taxonomy
					$count = count($terms); 
					
					// set a count value to 0
					$i=0;
					
					// test if the count has any categories
					if ($count > 0) {
						
						// break each of the categories into individual elements
						$term_list ='';
						foreach ($terms as $term) {
							
							// increase the count by 1
							$i++;
							
							// rewrite the output for each category
							$term_list .= '<li><a href="javascript:void(0)" class="'. $term->slug .'" title="'.$term->name .'">' . $term->name . '</a></li>' .'/';
							
							// if count is equal to i then output blank
							if ($count != $i)
							{
								$term_list .= '';
							}
							else 
							{
								$term_list .= '';
							}
						}
						
						// print out each of the categories in our new format
						echo $term_list;
					}
				?>
			</ul>
		<div class="filterable-grid column clearfix">
			<?php
			global $post;
			
			global $wp_query, $paged;
			$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
			$the_query = new WP_Query( array( 'post_type' => 'gallery', 'posts_per_page' =>'-1', 'paged' => $paged ) );
			$temp_query = $wp_query;
			$wp_query = null;
			$wp_query = $the_query; ?>

			
			<?php
			// The Loop
			while ( $the_query->have_posts() ) :
				$the_query->the_post();
				$terms = get_the_terms( $post->ID, 'gallery_category' );
				$output = '<div class="gal-image one-third" data-id="id-'.$count.'" data-type="';
          		if ( $terms && ! is_wp_error( $terms ) ) : 
			         foreach ($terms as $term){
			         	$output .= strtolower(preg_replace('/\s+/', '-', $term->name)).' ';
			         }
       			endif;
				$output .='">';
					if ( has_post_thumbnail() ) {
						$large = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'large' );
				      $output .= '<a  class="gallery-fancybox" href="' .$large[0]. '" title="' .the_title( '', '', false ). '">';
				      $output .= get_the_post_thumbnail( $post->ID,'gallery' );
				      $output .= '</a>';
				   }
				$output .= '<h3 class="custom-gallery-title">'.the_title( '', '', false ).'</h3>';
				$output .= "</div>";
				echo $output;
				$count++;
			endwhile;
			?>
		</div><!-- .column -->
		<?php
		if ( function_exists('wp_pagenavi' ) ) { 
			wp_pagenavi();
		}
		else {
			if ( $wp_query->max_num_pages > 1 ) {
			?>
				<ul class="default-wp-page clearfix">
					<li class="previous"><?php next_posts_link( __( '&laquo; Previous Images', 'interface' ), $wp_query->max_num_pages ); ?></li>
					<li class="next"><?php previous_posts_link( __( 'Next Images &raquo;', 'interface' ), $wp_query->max_num_pages ); ?></li>
				</ul>
				<?php 
			}
		}

		/** 
		 * Restore original Post Data 
		 * NB: Because we are using new WP_Query we aren't stomping on the 
		 * original $wp_query and it does not need to be reset.
		 */
		$wp_query = $temp_query;
		wp_reset_postdata();
		?>
	</div><!-- #content -->
<?php
}
unhook functions

// Unhook default Thematic functions
function unhook_thematic_functions() {
    // Don't forget the position number if the original function has one

add_action( 'interface_gallery_three_column_template_content', 'interface_gallery_three_column_template_content', 10 );

}
add_action('init','unhook_thematic_functions');

add_action( 'interface_gallery_three_column_template_content', 'interface_child_gallery_three_column_template_content', 10 );

 
 
function interface_child_gallery_three_column_template_content() {      ?>   
<div id="content">
    <ul class="gal-filter clearfix">
      <li class="active no-padding-left"><a href="javascript:void(0)" class="all" title="ALL"><?php _e('All','interface');?></a></li>/
      <?php
          // Get the taxonomy
          $terms = get_terms('gallery_category');
          
          // set a count to the amount of categories in our taxonomy
          $count = count($terms); 
          
          // set a count value to 0
          $i=0;
          
          // test if the count has any categories
          if ($count > 0) {
            
            // break each of the categories into individual elements
            $term_list ='';
            foreach ($terms as $term) {
              
              // increase the count by 1
              $i++;
              
              // rewrite the output for each category
              $term_list .= '<li><a href="javascript:void(0)" class="'. $term->slug .'" title="'.$term->name .'">' . $term->name . '</a></li>' .'/';
              
              // if count is equal to i then output blank
              if ($count != $i)
              {
                $term_list .= '';
              }
              else 
              {
                $term_list .= '';
              }
            }
            
            // print out each of the categories in our new format
            echo $term_list;
          }
        ?>
      </ul>
    <div class="filterable-grid column clearfix">
      <?php
      global $post;
      
      global $wp_query, $paged;
      $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
      $the_query = new WP_Query( array( 'post_type' => 'gallery', 'posts_per_page' =>'-1', 'paged' => $paged ) );
      $temp_query = $wp_query;
      $wp_query = null;
      $wp_query = $the_query; ?>

      
      <?php
      // The Loop
      while ( $the_query->have_posts() ) :
        $the_query->the_post();
        $terms = get_the_terms( $post->ID, 'gallery_category' );
        $output = '<div class="gal-image one-third" data-id="id-'.$count.'" data-type="';
              if ( $terms && ! is_wp_error( $terms ) ) : 
               foreach ($terms as $term){
                $output .= strtolower(preg_replace('/\s+/', '-', $term->name)).' ';
               }
            endif;
        $output .='">';
          if ( has_post_thumbnail() ) {
            $large = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'large' );
              $output .= '<a  href="'.get_permalink().'" title="' .the_title( '', '', false ). '">';
              $output .= get_the_post_thumbnail( $post->ID,'gallery' );
              $output .= '</a>';
           }
        $output .= '<h3 class="custom-gallery-title"><a href="'.get_permalink().'">'.the_title( '', '', false ).'</a>' .'</h3>';
        $output .= "</div>";
        echo $output;
        $count++;
      endwhile;
      ?>
    </div><!-- .column -->
    <?php
    if ( function_exists('wp_pagenavi' ) ) { 
      wp_pagenavi();
    }
    else {
      if ( $wp_query->max_num_pages > 1 ) {
      ?>
        <ul class="default-wp-page clearfix">
          <li class="previous"><?php next_posts_link( __( '&laquo; Previous Images', 'interface' ), $wp_query->max_num_pages ); ?></li>
          <li class="next"><?php previous_posts_link( __( 'Next Images &raquo;', 'interface' ), $wp_query->max_num_pages ); ?></li>
        </ul>
        <?php 
      }
    }

    /** 
     * Restore original Post Data 
     * NB: Because we are using new WP_Query we aren't stomping on the 
     * original $wp_query and it does not need to be reset.
     */
    $wp_query = $temp_query;
    wp_reset_postdata();
    ?>
  </div><!-- #content -->
  <?php 
}

Hope this may help you

Thank you!