Forum Replies Created

Viewing 2 replies - 16 through 17 (of 17 total)
  • Thread Starter HaneD

    (@haned)

    I got this sorted

    Here is the new shortcode’s code

    //Register equipment shortcode
    add_shortcode( 'equipment', 'exc_agriq_equipment_shortcode' );
    
    //The callback function that will replace [equipment]
    function exc_agriq_equipment_shortcode() {
    ?>
    <script type="text/javascript">
    jQuery(document).ready(
    
    	function() {
    		//Equal columns
        jQuery(".equalHeights").equalHeights();
        }
    );
    
    </script>
    <?php
     echo "<ul class='equalHeights'>";
    
    		$paged = 1;
       	if ( get_query_var('paged') ) $paged = get_query_var('paged');
        if ( get_query_var('page') ) $paged = get_query_var('page');
        $i = 0;
        $wp_query = new WP_Query( array(
          'post_type' => 'exc_agriq_equipment',
          'posts_per_page' => 16,
          'paged'=>$paged,
        )
    		);
    
            while ( $wp_query->have_posts() ) : $wp_query->the_post(); 
    
    				$exc_agriq_year = get_post_meta( get_the_ID(), 'exc_agriq_equipment_year', true );
    				$exc_agriq_hours = get_post_meta( get_the_ID(), 'exc_agriq_equipment_hours', true );
    				$exc_agriq_price = get_post_meta( get_the_ID(), 'exc_agriq_equipment_price', true );
    				$exc_agriq_kw = get_the_term_list( get_the_ID(), 'exc_equipment_kw', '', ', ', '');
    
    				?>
    
    				<li class="agriq-equipment-container">
    					<div class="agriq-equipment-detail">
    						<?php
    						$images = get_post_meta(get_the_ID(), 'exc_agriq_equipment_images', false);
    						$excagriqID = get_the_ID();
    
    						echo "<div class='agrig-equipment-images'>";
                foreach ($images as $att) {
                  // get image's source based on size, can be 'thumbnail', 'medium', 'large', 'full' or registed post thumbnails sizes
                  $srcthumb = wp_get_attachment_image_src($att, 'thumbnail');
                  $srcthumb = $srcthumb[0];
    							$src = wp_get_attachment_image_src($att, 'full');
                  $src = $src[0];
    
                  // show image
                  echo "<div class='agriq-equipment-image'><a href='$src' class='thickbox' rel='". $excagriqID ."'><img src='$srcthumb' width='150px' height='150px'/></a></div>";
    						}
    						?>
    						</div>
    						<div class="agriq-equipment-title"><h4><?php echo the_title(); ?></h4></div>
    						<div class="agriq-equipment-description"><?php echo the_content(); ?></div>
    						<div class="agriq-equipment-kw"><span>Kw:</span> <?php echo $exc_agriq_kw; ?></div>
    						<div class="agriq-equipment-year"><span>Jaar:</span> <?php echo $exc_agriq_year; ?></div>
    						<div class="agriq-equipment-hours"><span>Ure:</span> <?php echo $exc_agriq_hours; ?></div>
    						<div class="agriq-equipment-price"><span>Prys:</span> R<?php echo $exc_agriq_price; ?> BTW Ingesluit</div>
    					</div>
    				</li>
    
    				<?php
    				$i++; endwhile;
    				echo "</ul>";
    
    				if ( function_exists( 'wp_pagenavi' ) ) {
            	wp_pagenavi( array( 'query' => $wp_query ) );
            	wp_reset_postdata();
        		}
    
    }
    ?>

    Can you please tell me how you did this. I would really like to do something like this for archive pages

Viewing 2 replies - 16 through 17 (of 17 total)