• Resolved David

    (@loano1)


    Hi, I recently checked a few advert listing sites and saw that they all provide a custom ad id. Is it somehow possible to display the post id along with the ad?

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

    (@gwin)

    Add in your theme functions.php file the code below it will show the Ad ID on the Advert details page

    
    add_action( "adverts_tpl_single_details", "my_adverts_tpl_single_show_id" );
    function my_adverts_tpl_single_show_id( $post_id ) {
        ?>
        <div class="adverts-grid-row">
        <div class="adverts-grid-col adverts-col-30">
        <span class="adverts-round-icon adverts-icon-wordpress"></span>
        <span class="adverts-row-title">ID</span>
        </div>
        <div class="adverts-grid-col adverts-col-65">
        <?php esc_html_e( $post_id ) ?>
        </div>
        </div>
        <?php 
    }
    
    Thread Starter David

    (@loano1)

    Hi Greg, Thanks for your code! Is it possible to replace the “adverts-icon-wordpress”? The reason for that, the “ID” text is not visible on mobile so I would create an icon-image containing “ID”.

    And would it be possible to show the id above the location (below category)? Otherwise, it will be separated and moved down below the map.

    • This reply was modified 6 years, 4 months ago by David.
    Plugin Author Greg Winiarski

    (@gwin)

    1. to change icon replace adverts-icon-wordpress with some other FontAwesome icon name (but remember to prefix the icon name with adverts-icon-).

    2. it is not possible to display the ID above location at least not without modifying wpadverts/templates/single.php template file.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Show Ad-id’ is closed to new replies.