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

    (@gwin)

    Hi,
    if you are looking to just hide the “There are no ads …” text when there are no matching ads then you can do that by adding the code below in the wp-admin / Appearance / Customize / Additional CSS panel

    
    .single-advert .adverts-list-empty { display: none !important }
    

    To provide the IDs of the ads you want to show in the related_ads_list_query function you can add the below code

    
    $args["post__in"] = array(10,20,30);
    

    and probably remove the $args["s"] = $post->post_title;, one other thing our users do here is show the related ads by selecting some ads from the same category you could do that with the below code

    
    $terms = wp_get_post_terms( $post->ID, "advert_category" );
    $args["tax_query"] = array(
      'taxonomy' => 'advert_category',
      'field'    => 'term_id',
      'terms'    => $terms[0]->term_id,
    );
    
    Thread Starter 5vvo8jvod6

    (@5vvo8jvod6)

    Hi @gwin,

    When I add this css
    .single-advert .adverts-list-empty { display: none !important }

    The title of ‘Related Ads’ still showing. Any way to hide this title as well when there is no related ads found?

    Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    not really as this text is rendered before checking if there are any related ads to show at all.

    You could however remove the line

    
    echo '<h3>' . __( "Related Ads") . '</h3>';
    

    from the related-ads.php file so it will never be shown.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Related Ads Problem’ is closed to new replies.