• Resolved freizeitmonster

    (@freizeitmonster)


    Hello Greg,

    i have searched a long time in this forum but i cant find a solution for:
    – hiding the ad publishing date on ads card
    – display location under the ads title on ads cards

    How can i achive this customizations?

    Best,
    Sven

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

    (@gwin)

    Hi,
    to hide the date and move the location on the Ad details page you would need to customize the wpadverts/templates/single.php template file (will require some HTML/PHP knowledge).

    If you decide to do that, please consider creating a child-template file for the single.php template file as explained here https://wpadverts.com/doc/child-themes-and-templates/ in the “Replacing Default Templates” section so your changes will not be overwritten on the WPAdverts update.

    Thread Starter freizeitmonster

    (@freizeitmonster)

    I don’t get it in successfully.
    The publishing date (even if I delete it) is still displayed – even if I delete the cache …
    Can you please give me the PHP code for the Loctaions information in the ad cards?

    That would be awesome.

    Plugin Author Greg Winiarski

    (@gwin)

    If your changes are not visible on-site, then most likely there is some other template being used, maybe you are using the PeepSo integration? They do have their own template for WPAdverts pages.

    Either way it would be best if you could post here a link to the page where you are having this problem.

    Thread Starter freizeitmonster

    (@freizeitmonster)

    I’ve created a custom list-item plugin.
    And i put this code into the new list-item.php to delete the published date.
    This works. But the location informationen will not be displayed.
    And how to add the category string?

    <div class="<?php echo adverts_css_classes( 'advert-item advert-item-col-'.(int)$columns, get_the_ID() ) ?>">
    
        <?php $image_id = adverts_get_main_image_id( get_the_ID() ) ?>
        <div class="advert-img">
            <?php if($image_id): ?>
                <?php $image = get_post( $image_id ) ?>
                <img src="<?php echo esc_attr( adverts_get_main_image( get_the_ID() ) ) ?>" class="advert-item-grow" title="<?php echo esc_attr($image->post_excerpt) ?>" alt="<?php echo esc_attr($image->post_content) ?>" />
            <?php endif; ?>
        </div>
    
        <div class="advert-post-title">
            <span title="<?php echo esc_attr( get_the_title() ) ?>" class="advert-link">
                <span class="advert-link-text"><?php echo esc_html( get_the_title() ) ?></span>
                <?php do_action( "adverts_list_after_title", get_the_ID() ) ?>
            </span>
            <a href="<?php the_permalink() ?>" title="<?php echo esc_attr( get_the_title() ) ?>" class="advert-link-wrap"></a>
        </div>
    
        <div class="advert-published ">
    
            <?php $location = get_post_meta( get_the_ID(), "adverts_location", true ) ?>
            <?php if( ! empty( $location ) ): ?>
            <span class="advert-item-col-1-only advert-location adverts-icon-location"><?php echo esc_html( $location ) ?></span>
            <?php endif; ?>
    
            <?php $price = get_post_meta( get_the_ID(), "adverts_price", true ) ?>
            <?php if( $price ): ?>
            <div class="advert-price"><?php echo esc_html( adverts_get_the_price( get_the_ID(), $price ) ) ?></div>
            <?php elseif( adverts_config( 'empty_price' ) ): ?>
            <div class="advert-price adverts-price-empty"><?php echo esc_html( adverts_empty_price( get_the_ID() ) ) ?></div>
            <?php endif; ?>
        </div>
    
        <div>
            Item Location
        </div>
    
        <div>
            Item Categorie
        </div>
    
    </div>

    Website: https://www.myfreizeit.de

    Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    in your case both location and category are taxonomies so it depends on how you want to display them, if just the selected term as a string then you can use the below code

    
    $post_id = get_the_ID();
    
    $terms = get_the_terms( $post_id, 'advert_category' );
    if( isset( $terms[0] ) ) {
      echo "Category: " . $terms[0]->name;
    }
    
    $terms = get_the_terms( $post_id, 'advert_location' );
    if( isset( $terms[0] ) ) {
      echo "Location: " . $terms[0]->name;
    }
    
    Thread Starter freizeitmonster

    (@freizeitmonster)

    Brilliant.
    Thank you very much.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to hide publish-date and display location?’ is closed to new replies.