Display ADs

Tagged: ,

This topic contains 19 replies, has 2 voices, and was last updated by  CTHthemes 5 months, 4 weeks ago.

Viewing 20 posts - 1 through 20 (of 20 total)
  • Author
    Posts
  • #29405

    chamer
    Participant

    Support Expired

    When I create ads for certain companies they appear in all searches, for example: a barber shop is advertising and if I search for restaurants it will appear in this search. It should only be displayed in the barber shop category.

    How to display the ads separated by category?

    #29447

    CTHthemes
    Keymaster

    You can try Listing Category ad type: http://prntscr.com/mjds02
    So your ad listing will showing in its category only.

    #29470

    chamer
    Participant

    Support Expired

    Hi!

    Thanks for the answer.
    I tried to do this but it continues to show for all categories. It actually only displays when it is searched. However, it is displayed for any category searched, not only for the category to which that advertised company belongs.

    Thanks.

    #29483

    CTHthemes
    Keymaster

    Would you send me the page link and tell me how to get the error?

    #29494

    chamer
    Participant

    Support Expired

    Of course!

    The website is agendameubairro.com.br
    and the search page: https://agendameubairro.com.br/?search_term=&lcats%5B%5D=248&post_type=listing
    In this case the search is showing the gym category and shows ads from other categories.

    #29510

    CTHthemes
    Keymaster

    Hi, please try replace the listing with new one then apply category ad to it.

    #29534

    chamer
    Participant

    Support Expired

    Hello! I could not understand what I should do, can you clarify?

    #29537

    chamer
    Participant

    Support Expired

    Viewing the codes it seems that it is not only showing of the category, it is searching for all the ads, limiting only in quantity, defined in the Ads menu.

    #29562

    CTHthemes
    Keymaster

    It was limited by current category: http://prntscr.com/mmhx2o

    #29595

    chamer
    Participant

    Support Expired

    Seeing here, I need to select the first choice of ads on the configuration page (img01) to run the ads display in searches without category separation. Even selecting the second one also does not change the display but if you select only the second option, it does not show any ads.

    Through the tests I performed it is coming in the variable category but it is not filtering when it is displayed.

    Thanks!

    Attachments:
    You must be logged in to view attached files.
    #29608

    CTHthemes
    Keymaster

    Even selecting the second one also does not change the display but if you select only the second option, it does not show any ads.

    –> As you can see in the code above, the second option ( listing category ad doesn’t show on archive/search page ). They display on listing category page only ( domain.com/listing_cat/listing-category-slug/ )

    #29629

    chamer
    Participant

    Support Expired

    Great! And how can I use the same ad logic for categories within the search return page (I’m not using ajax)

    #29654

    CTHthemes
    Keymaster

    Did you mean when selecting a category only ad for that category showing? http://prntscr.com/mnh8ex

    #29686

    chamer
    Participant

    Support Expired

    Yes, exactly that.

    How do I do that?

    Thanks!

    #29718

    CTHthemes
    Keymaster

    Try this modification: http://prntscr.com/mny07c

    
    if( isset($_GET['lcats']) && !empty( array_filter($_GET['lcats']) ) ){
                            $ad_posts_args['tax_query'] = array(
                                array(
                                    'taxonomy' => 'listing_cat',
                                    'field'    => 'term_id',
                                    'terms'    => $_GET['lcats'],
                                ),
                            );
                        }
    
    #29722

    chamer
    Participant

    Support Expired

    Still not working
    Is there any other place I need to change the code?

    #29728

    CTHthemes
    Keymaster

    Did you delete server and browser caches?

    #29731

    chamer
    Participant

    Support Expired

    Yes, I deleted the cache. I will keep trying to update and monitor if there is any change. But only this change is necessary?

    For example, when I use var_dump, it displays these variables, without the change made:
    array(5) {
    [“post_type”]=>
    string(7) “listing”
    [“orderby”]=>
    string(10) “menu_order”
    [“order”]=>
    string(3) “ASC”
    [“posts_per_page”]=>
    string(2) “10”
    [“meta_query”]=>
    array(4) {
    [“relation”]=>
    string(3) “AND”
    [0]=>
    array(2) {
    [“key”]=>
    string(10) “_cth_is_ad”
    [“value”]=>
    string(3) “yes”
    }
    [1]=>
    array(2) {
    [“key”]=>
    string(24) “_cth_ad_position_archive”
    [“value”]=>
    string(3) “yes”
    }
    [2]=>
    array(4) {
    [“key”]=>
    string(14) “_cth_ad_expire”
    [“value”]=>
    string(19) “2019-02-21 03:51:46”
    [“compare”]=>
    string(2) “>=”
    [“type”]=>
    string(8) “DATETIME”
    }
    }
    }

    #29732

    chamer
    Participant

    Support Expired

    I got it!

    I made the change out of the IF as in the attached image.

    Thanks a lot for the help! Best support I’ve seen of all the models I’ve ever purchased

    • This reply was modified 6 months ago by  chamer.
    Attachments:
    You must be logged in to view attached files.
    #29762

    CTHthemes
    Keymaster

    You are welcome 🙂

Viewing 20 posts - 1 through 20 (of 20 total)

You must be logged in to reply to this topic.

New featues: CityBook - Listing & Directory WordPress Theme version 2.1.8 was outUpdate now
+