Popular Categories Homepage

This topic contains 14 replies, has 3 voices, and was last updated by  Stiofan O’Connor 6 years, 3 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #416715

    Brendan O’Donovan
    Expired Member
    Post count: 40

    I am using the supreme directory theme and I want to display 2 buttons on the homepage where the popular categories is underneath the search bar. However I am have difficulty locating the necessary php file. I looked at a previous question from https://wpgeodirectory.com/support/topic/popular-categories-supreme-theme/. Have you made changes to the content.php since then

    #416836

    Alex Rollin
    Moderator
    Post count: 27815

    Hello,

    You can try inc/geodirectory-compatibility.php

    We recommend you not make changes to the theme because they will be overwritten on update.

    Why not try a text widget on the home and add your HTML there?

    #416888

    Brendan O’Donovan
    Expired Member
    Post count: 40

    Hi Alex, thank you but I don’t think I can put a widget into the area that I am looking at putting a button into. Is where the popular categories is underneath the search bar in the supreme theme. I could be wrong but the only way to achieve this would be to edit the core files

    #416906

    Alex Rollin
    Moderator
    Post count: 27815

    I think you might be right. Let me flag this for the developers in case they have a different idea about it.

    #416977

    Brendan O’Donovan
    Expired Member
    Post count: 40

    Thanks very much Alex

    #417195

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Hello,

    I am not sure exactly what you are trying to do but you can use hooks like:

    
    
    add_action('sd_homepage_content','_my_new_homepage_content');
    function _my_new_homepage_content(){
        echo "this is new!";
    }

    Thanks,

    Stiofan

    #417534

    Brendan O’Donovan
    Expired Member
    Post count: 40

    Hi Stiofan, thank you for your response however I was looking a putting a button underneath the search bar. Is there any hooks that can achieve this without having to modify the core files.

    #417556

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    there is no filter in between those, not unless u remove and then add back the entire filter.

    Stiofan

    #417558

    Brendan O’Donovan
    Expired Member
    Post count: 40

    I’m not sure if I explained myself very well. I was hoping to replace the popular categories under the search bar with a button. Is this possible without having to remove the filter and adding it back as I am not sure how that would be done

    #417560

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    No that is not possible you would need to remove it and add it back something like this

    
    
    add_action( 'after_setup_theme', '_my_remove_theme_actions' );
    function _my_remove_theme_actions(){
      remove_action('sd_homepage_content','sd_homepage_featured_content');
    }
    function _my_sd_homepage_featured_content() {
        if (is_singular() && geodir_is_page('location') && $location = sd_gd_current_location_name() ) { 
           echo '<h1 class="entry-title">'. esc_attr(__($location, 'geodirectory')).'</h1>';
        } else { 
            echo '<h1 class="entry-title">'. get_the_title() .'</h1>';
         }
    
        $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();
       // removed echo do_shortcode('[gd_popular_post_category category_limit=5 category_restrict=1]');
    echo "MY NEW BUTTON CAN GO HERE";
        
        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('sd_homepage_content','_my_sd_homepage_featured_content');

    Stiofan

    #417574

    Brendan O’Donovan
    Expired Member
    Post count: 40
    This reply has been marked as private.
    #417598

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Please also provide FTP details and let me know where u tried to add the code?

    Thanks,

    Stiofan

    #417607

    Brendan O’Donovan
    Expired Member
    Post count: 40
    This reply has been marked as private.
    #417610

    Brendan O’Donovan
    Expired Member
    Post count: 40

    Sorry forgot to say I added the code to code snippets
    And saved it with the name new .

    #417611

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Thanks for the info.

    I have fixed it now and updated the code above/

    Stiofan

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

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

Open Support Ticket