• Resolved boybawang

    (@boybawang)


    Hello –

    Is it possible to be able to add some text at the top of a featured ad? For example, we just want to be able to add the word Featured so featured ads stand out a bit more. I was able to accomplish this with CSS in the Grid view, but had to hide it in List view because it didn’t look good.

    I’m familiar with the CSS on this page, but I don’t think any of those selectors would work (or would they?).

    Thanks

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

    (@gwin)

    Hi,

    in the list view you can show the FEATURED word after the title by adding the code below in the wp-admin / Appearance / Customize / Additional CSS panel

    .wpa-list-view .wpa-result-item.advert-is-featured .wpa-result-link::after {
      content: '- FEATURED';
    }
    Thread Starter boybawang

    (@boybawang)

    Is it possible to have it directly above the image?

    Hello,

    You can try this. It will put an image on the top left of the ad image.

    You can put it the function.php file or just make a plugin

    // Feature List Title

    add_action( “adverts_list_after_title”, function( $post_id ) {
    $post = get_post( $post_id );
    if( $post->menu_order < 1 ) {
    return;
    }
    echo ‘location of image’;
    } );

    // Feature Display Page

    add_action( “adverts_tpl_single_top”, function( $post_id ) {
    $post = get_post( $post_id );
    if( $post->menu_order < 1 ) {
    return;
    }
    echo ‘location of image’;
    } );

    sample image

    https://www.screenpresso.com/=wIC4b

    Plugin Author Greg Winiarski

    (@gwin)

    Hi,

    you can use the snippet by @nmccainjr to do that, but to postition the “FEATURED” flag above the image you will need it to show a HTML code like this

    add_action( "adverts_list_after_title", function( $post_id ) {
        $post = get_post( $post_id );
        if( $post->menu_order < 1 ) {
            return;
        }
        echo '<span style="position:absolute; top: 5px; right: 5px; background: silver; ">FEATURED</span>';
    } );

    Note that this will display in both Grid and List modes.

    Thread Starter boybawang

    (@boybawang)

    Thank you @gwin and @nmccainjr !

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Add text to featured ad’ is closed to new replies.