John Els
Forum Replies Created
-
AuthorPosts
-
August 11, 2016 at 12:36 pm in reply to: Show Ads on Free Listings but not on Paid Listings? #245126
Stiofan, thanks for your help with this. That piece of code that you posted, got me started in the right direction. In the end, I learned something new about WordPress too.
Have a great day 🙂
John
August 10, 2016 at 10:09 pm in reply to: Show Ads on Free Listings but not on Paid Listings? #244827In the end, this code below did the trick. It only inserts ads when the package ID is 7, 8, or 9 (my free packages). The ad code just goes directly in the code, i.e. no admin UI. I created two of these functions and stuck them in a plugin. It seems to work fine. If you see anything in this code that is bad practice, or something I overlooked, please let me know.
add_action( 'geodir_before_tab_list', 'insert_ad_above_tabs', 10, 0 ); function insert_ad_above_tabs() { global $post; $adcode = 'MY AD CODE HERE'; if (geodir_is_page('detail') && isset($post->package_id)) { if ($post->package_id == 7 || $post->package_id == 8 || $post->package_id == 9) { echo '<div class="ad-above-tabs">'.$adcode.'</div>'; } } }
Hi Stiofan,
It looks like I found the Actions I was looking for. geodir_before_tab_list drops content directly above the tabs. geodir_after_single_post drops content below the tabs, at the bottom of that section of the page. Is there any reason that you can think of that would make those two Actions unsuitable?
Now I only have to implement the filtering by package ID.
Thanks for your help. This is awesome!
John
Stiofan,
I have something working now, but it’s just in the wrong location. I tested with geodir_before_detail_page_more_info, which drops it in the sidebar.
Can you tell me if there is an Action that will let me drop some content between the taxonomies output and the tabs on the detail page? What about an Action that will drop content below the tabs?
Thanks,
JohnHi Stiofan,
Thanks very much! That is very helpful. I’m working on it now.
John
Hi Stiofan,
Thanks for that. I’m not 100% sure how to take that further, but it is giving me a clue. I’m going to have to do a little learning here, but hopefully I’m up to the challenge and can pull a rabbit out of the hat.
Thanks again!
John
August 10, 2016 at 12:45 pm in reply to: Show Ads on Free Listings but not on Paid Listings? #244504Sorry, I should have added this to my last reply:
Are there functions or hooks that I can use to:
1. Identify the CPT being loaded?
2. Identify the price package for the listing being loaded?
3. Identify each section of a listing page being loaded?I’m thinking that if I can identify those items while a listing detail page is being loaded, I can insert ad code on the desired pages and at the desired locations.
August 10, 2016 at 12:02 pm in reply to: Show Ads on Free Listings but not on Paid Listings? #244465Thanks for the reply, Kor. Are there any GD hooks or functions that I can look at to try to implement this? While I’m not an expert on WP coding, I have written a line or two of PHP code and may be able to implement this myself. I’m just not familiar with GD’s hooks and functions. Thanks 🙂
-
AuthorPosts