Setting Location In Navigation Bar

This topic contains 19 replies, has 4 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
  • #414958

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Not unless you first add the location slug as a body class.

    The above function get the multilocation SEO settings for the location, you can use them how you wish.

    if you do this you will see the avaliable info:

    
    
    $seo = geodir_get_location_seo();
    print_r( $seo );

    Stiofan

    #415030

    Garrick Soohoo
    Free User
    Post count: 37

    How do you add the location slug as a body class?

    #415156

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Below is a quick example (not tested)

    
    
    add_filter('body_class', '_my_add_body_class');
    
    function _my_add_body_class($classes) {
            $location_terms = geodir_get_current_location_terms();
    if(isset($location_terms['gd_city']) && $location_terms['gd_city']){
    $classes[] =  "current-city-".esc_attr($location_terms['gd_city']);
    }
            return $classes;
    }

    Thanks,

    Stiofan

    #415435

    Garrick Soohoo
    Free User
    Post count: 37

    Prevuious unfinished question: Is there a way to make the title & meta variables work in the widget body areas?

    I know https://wpgeodirectory.com/docs/gd-core-plugin-titles-metas/ has a way to make the title & meta variables show in the widget titles, but was wondering about getting it to work content/text area.

    Answer: Not tested but you could try “the_content” filter.
    …….

    *********I still can’t get it to work. What should I add to the function.php to active the title variables in the widget content?

    #415443

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    There is no way to do what u are asking (i checked).

    What widget are u trying to get the variables to work in, and what variables?

    Stiofan

Viewing 5 posts - 16 through 20 (of 20 total)

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

Open Support Ticket