Title: Adding information and layout.
Last modified: August 31, 2016

---

# Adding information and layout.

 *  Resolved [MrWilson2013](https://wordpress.org/support/users/mrwilson2013/)
 * (@mrwilson2013)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/adding-information-and-layout/)
 * Hello, I’ve tried a few plugins and by far this one seems to be the best one 
   i’ve used.
 * I’m having some issue adding what I need though. I want to show the related products
   using this layout (coming from a working similar products php which works but
   I cant select manual relation)
 *     ```
       <?php
       if( has_post_thumbnail() ){
       the_post_thumbnail();
       }
       else{
       echo '<img src="'.esc_url( get_template_directory_uri().'/images/product-placeholder.jpg' ).'">';
       }
       ?>
       </div>
       <div>
       <a class="overlay" href="<?php the_permalink() ?>">
       <i class="fa fa-compress"></i>
       <h3><?php _e( 'COMPARE', 'compare' ) ?></h3>
       </a>
   
       <div style="font-size:16px; font-weight:bold;">
       <?php if ( CFS()->get( 'manual_price' ) ){  ?>
       <div class="price-box-cust">
       <?php echo CFS()->get( 'manual_price'); ?>
       </div>
       <?php } else { ?>
       <?php
       $min_price = !empty( $product_metas[get_the_ID()] ) ? $product_metas[get_the_ID()]['minPrice'] : 0;
       echo __( '', 'compare' ).'<div class="price-box-cust">'.compare_format_currency_number( $min_price ).'</div>';
       ?><?php } ?>
   
       </div>
   
       </div>
   
       </div>
   
       <div class="white-block-content">
       <h4>
       <a href="<?php the_permalink() ?>">
       <?php
       $title = get_the_title();
       if( strlen( $title ) > 25 ){
       $title = substr( $title, 0, 25 ).'...';
       }
       echo esc_html( $title );
       ?>
       </a>
   
       </h4>
       <p class="product-ratings">	<?php compare_get_ratings() ?></p>
   
       <div class="myDiv" style="font-weight:bold; padding:0px 0px 5px 0px; color:#900; font-size:13px;"><?php echo CFS()->get( 'price_message' ); ?></div>
   
       </div>
       ```
   
 * Would you be a massive help and help me with this? I’ve tried all the ways I 
   know off.
 * Many thanks look forward to your reply
 * [https://wordpress.org/plugins/related/](https://wordpress.org/plugins/related/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Marcel Pol](https://wordpress.org/support/users/mpol/)
 * (@mpol)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/adding-information-and-layout/#post-7417175)
 * Hi,
    With CSF I am not familiar, but just following the codex, and using the 
   post_ID for functions brings me to this (untested). Does that help you?
 *     ```
       global $related;
       $rel = $related->show( get_the_ID(), true );
   
       // Display the title of each related post
       if( is_array( $rel ) && count( $rel ) > 0 ) {
       	foreach ( $rel as $r ) {
       		if ( is_object( $r ) ) {
       			if ($r->post_status != 'trash') {
       				?>
       				<div>
       					<?php
       					echo get_the_title( $r->ID ) . '<br />';
   
       					if ( has_post_thumbnail( $r->ID ) ) {
       						echo get_the_post_thumbnail( $r->ID );
       					} else {
       						echo '<img src="'.esc_url( get_template_directory_uri().'/images/product-placeholder.jpg' ).'">';
       					}
       					?>
       				</div>
       				<div>
       					<a class="overlay" href="<?php echo get_permalink( $r->ID ) ?>">
       						<i class="fa fa-compress"></i>
       						<h3><?php _e( 'COMPARE', 'compare' ) ?></h3>
       					</a>
   
       					<div style="font-size:16px; font-weight:bold;">
       						<?php
       						if ( CFS()->get( 'manual_price' ) ){  ?>
       							<div class="price-box-cust">
       								<?php echo CFS()->get( 'manual_price'); ?>
       							</div>
       							<?php
       						} else {
       							$min_price = !empty( $product_metas[get_the_ID()] ) ? $product_metas[get_the_ID()]['minPrice'] : 0;
       							echo __( '', 'compare' ).'<div class="price-box-cust">'.compare_format_currency_number( $min_price ).'</div>';
       						} ?>
       					</div>
       				</div>
   
       				<div class="white-block-content">
       					<h4>
       						<a href="<?php echo get_permalink( $r->ID ) ?>">
       							<?php
       							$title = get_the_title( $r->ID );
       							if( strlen( $title ) > 25 ){
       							$title = substr( $title, 0, 25 ).'...';
       							}
       							echo esc_html( $title );
       							?>
       						</a>
       					</h4>
       					<p class="product-ratings"><?php compare_get_ratings() ?></p>
   
       					<div class="myDiv" style="font-weight:bold; padding:0px 0px 5px 0px; color:#900; font-size:13px;">
       						<?php echo CFS()->get( 'price_message' ); ?>
       					</div>
   
       				</div>
       				<?php
       			}
       		}
       	}
       }
       ```
   
 *  Thread Starter [MrWilson2013](https://wordpress.org/support/users/mrwilson2013/)
 * (@mrwilson2013)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/adding-information-and-layout/#post-7417176)
 * The layout works perfectly everything is in its correct place.
 * 2 issues. First the related post I selected doesnt show, The product im currently
   on shows. (Current post)
 * The second issue is, is that the prices will not show. It just sets them to £
   0.00
 * This is the price bit on its own. and this is the plugin im using
 * [https://wordpress.org/plugins/custom-field-suite/](https://wordpress.org/plugins/custom-field-suite/)`
 *     ```
       <?php if ( CFS()->get( 'manual_price' ) ){  ?>
       <div class="price-box-cust">
       <?php echo CFS()->get( 'manual_price'); ?>
       </div>
       <?php } else { ?>
       <?php
       $min_price = !empty( $product_metas[get_the_ID()] ) ? $product_metas[get_the_ID()]['minPrice'] : 0;
       echo __( '', 'compare' ).'<div class="price-box-cust">'.compare_format_currency_number( $min_price ).'</div>';
       ?><?php } ?>
       ```
   
 *  Thread Starter [MrWilson2013](https://wordpress.org/support/users/mrwilson2013/)
 * (@mrwilson2013)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/adding-information-and-layout/#post-7417177)
 * Fixed the first Issue above – Didnt copy it correctly over. I can only add 2 
   related items before it clones itself.
 * [http://www.awesomescreenshot.com/image/1285557/904ffcbf7ca3c725016dd62da55a1178](http://www.awesomescreenshot.com/image/1285557/904ffcbf7ca3c725016dd62da55a1178)
 *  Plugin Author [Marcel Pol](https://wordpress.org/support/users/mpol/)
 * (@mpol)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/adding-information-and-layout/#post-7417180)
 * Just looking at that piece of code….
 * I don’t know what the last functioncall is from.
 * And that it doesn’t loop correctly is a bit strange. Could you run:
    var_dump(
   $related ); on top after the $related->show() call?
 *     ```
       <?php if ( CFS()->get( 'manual_price', $r->ID ) ){  ?>
       <div class="price-box-cust">
       <?php echo CFS()->get(  'manual_price', $r->ID ); ?>
       </div>
       <?php } else { ?>
       <?php
       $min_price = !empty( $product_metas[ $r->ID ] ) ? $product_metas[ $r->ID]['minPrice'] : 0;
       echo __( '', 'compare' ).'<div class="price-box-cust">'.compare_format_currency_number( $min_price ).'</div>';
       ?><?php } ?>
       ```
   

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Adding information and layout.’ is closed to new replies.

 * ![](https://ps.w.org/related/assets/icon-256x256.png?rev=2313348)
 * [Manual Related Posts](https://wordpress.org/plugins/related/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/related/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/related/)
 * [Active Topics](https://wordpress.org/support/plugin/related/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/related/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/related/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Marcel Pol](https://wordpress.org/support/users/mpol/)
 * Last activity: [9 years, 11 months ago](https://wordpress.org/support/topic/adding-information-and-layout/#post-7417180)
 * Status: resolved