Inserting Adsense Block Below Search On Homepage

This topic contains 5 replies, has 3 voices, and was last updated by  Giri 4 years, 2 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #397713

    christian guynn
    Free User
    Post count: 4

    I’d like to add some adsense code below the search fields and above the popular categories as seen in the attached image. Which plugin files should I look for to make that edit? I’m using the supreme-directory theme if that makes a difference. Thanks for your help as always.

    #397730

    Paolo
    Site Admin
    Post count: 31205

    Hi,

    It’s a theme file. inc/geodirectory-compatibility.php

    However it’d be better to not touch files directly or changes will be lost after updates.

    I asked to the developers to let us know if it’s feasible via hooks.

    They’ll let us know asap,

    Thanks

    #397733

    christian guynn
    Free User
    Post count: 4

    Great. Thanks.

    #397738

    Giri
    Expired Member
    Post count: 3155

    Hi Christian,

    Install code snippets plugin and then use this code.

    https://wordpress.org/plugins/code-snippets/

    
    
    function modified_sd_homepage_featured_content() {
        if (is_singular() && geodir_is_page('location') && $location = sd_gd_current_location_name() ) { ?>
            <h1 class="entry-title"><?php echo esc_attr(__($location, 'geodirectory')); ?></h1>
        <?php } else { ?>
            <h1 class="entry-title"><?php the_title(); ?></h1>
        <?php }
    
        $sub_title = get_post_meta(get_the_ID(), 'subtitle', true);
    
        if (geodir_is_page('location') && defined('GEODIRLOCATION_VERSION')) {
            $loc = geodir_get_current_location_terms();
            $location_type = geodir_what_is_current_location();
            $country_slug = '';
            $region_slug = '';
            if ($location_type == 'city') {
                $slug = $loc['gd_city'];
                $region_slug = isset($loc['gd_region']) ? $loc['gd_region'] : '';
                $country_slug = isset($loc['gd_country']) ? $loc['gd_country'] : '';
            } else if ($location_type == 'region') {
                $slug = $loc['gd_region'];
                $country_slug = isset($loc['gd_country']) ? $loc['gd_country'] : '';
            } elseif($location_type == 'country') {
                $slug = $loc['gd_country'];
                $country_slug = isset($loc['gd_country']) ? $loc['gd_country'] : '';
            }
            else {
                $slug = '';
            }
            $seo = geodir_location_seo_by_slug($slug, $location_type, $country_slug, $region_slug);
            $tagline = (isset($seo->seo_image_tagline)) ? __($seo->seo_image_tagline, 'geodirlocation') : '';
            if ($tagline) {
                $sub_title = stripslashes($tagline);
            }
    
        }
        if (isset($sub_title)) {
            echo '<div class="entry-subtitle">' . $sub_title . '</div>';
        }
    
        sd_search_form_shortcode();
        ?>
        <div class="home-page-ad">
            Ad code goes here
        </div>
        <?php
        echo do_shortcode('[gd_popular_post_category category_limit=5 category_restrict=1]');
    
        echo '<div class="home-more" id="sd-home-scroll"><a href="#sd-home-scroll" ><i class="fa fa-chevron-down"></i></a></div>';
    }
    add_action('init', 'modified_sd_homepage_featured_content_init', 4);
    function modified_sd_homepage_featured_content_init() {
        remove_action('sd_homepage_content','sd_homepage_featured_content');
        add_action('sd_homepage_content','modified_sd_homepage_featured_content');
    }
    #397761

    christian guynn
    Free User
    Post count: 4

    Great. I’ll try it out. Thanks.

    #397844

    Giri
    Expired Member
    Post count: 3155

    You are welcome.

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

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket