Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    To display price below the location add in your theme functions.php file the below code

    
    add_action( "adverts_tpl_single_details", function( $post_id ) {
        ?>
    
        <div class="adverts-grid-row">
        <div class="adverts-grid-col adverts-col-30">
        <span class="adverts-round-icon adverts-icon-dollar"></span>
        <span class="adverts-row-title">Price</span>
        </div>
        <div class="adverts-grid-col adverts-col-65">
        <?php echo esc_html( adverts_get_the_price( $post_id ) ) ?>
        </div>
        </div>
        <?php 
    } );
    
    Thread Starter labyrinth207

    (@labyrinth207)

    Thanks for this.

    However, when price is empty it shows the row blank (see https://prnt.sc/qr0s7k)
    It should follow the setting of “Empty Price Text” found in the common settings (see https://prnt.sc/qr0sg2)

    Plugin Author Greg Winiarski

    (@gwin)

    Change the line

    
    <?php echo esc_html( adverts_get_the_price( $post_id ) ) ?>
    

    to

    
    <?php $price = get_post_meta( $post_id, "adverts_price", true ) ?>
    <?php if( $price ): ?>
    <?php echo esc_html( adverts_get_the_price( $post_id, $price ) ) ?>
    <?php elseif( adverts_config( 'empty_price' ) ): ?>
    <?php echo esc_html( adverts_empty_price( get_the_ID() ) ) ?>
    <?php endif; ?>
    
    Thread Starter labyrinth207

    (@labyrinth207)

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Displaying price inside the row’ is closed to new replies.