Daniel Gray

Forum Replies Created

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • in reply to: return sub categories #1435038
    Daniel Gray
    Participant

    I am trying to create a dynamic drop down menu that will consist of children of a parent category, this will replace the “search” filed.
    For example, the find a class page (http://www.fitboxworld.com/find-a-class/) will display child categories of the class parent.
    The find an Event page (http://www.fitboxworld.com/find-a-class/) will display child categories of the event parent category.
    The find an Training page (http://www.fitboxworld.com/find-a-training/) will display child categories of the parent training category.
    All children need to be displayed by a drop down menu for choices.
    For example:
    on find a class page there needs to be a drop down menu that lisis:
    Classes
    – Basic
    – Advanced
    – Extreme
    … (dynamic to categories added/removed)

    the find an event will list|
    Events
    – Demos
    – Trainings
    – fitboxathons

    Find a training will list
    Trainings
    – Basic
    – Advanced
    – Extreme
    ….

    Thank you,
    Mike

    in reply to: return sub categories #1430970
    Daniel Gray
    Participant

    The get_term_children looks like it would work for my needs.
    However, what args should be passed to it to return an array of sub categories (children) based on parent?
    For example:
    Pass main category such as classes, events, trainings etc.
    Return an array of sub categories (or children) based on parent.
    I.E.
    Pass classes category to function and get array of child elements:
    array (advanced, basic, extreme, silver, toning, junior, …);

    Pass events category, the return should be an array with child elements:
    array(fitbox demos, fixboxathon, new partner, …);

    in reply to: Change all labels in tribe search bar #1424848
    Daniel Gray
    Participant

    Can you point me the right directions as to what functions I may need to accomplish this?

    in reply to: Change all labels in tribe search bar #1424036
    Daniel Gray
    Participant

    I have a seperate question:

    I am using some custom code located on github here: https://github.com/bordoni/tec-forum-support/blob/plugin-949602/plugin.php

    This displays the drop down on all three pages.
    I need this to be dynamic where it pulls sub-categories from main category.

    Example
    Classes Page: http://www.fitboxworld.com/find-a-class/

    Classes //main cat
    – ALL // list all sub categories
    – FITBOX // sub
    – EXTREME // sub
    – …..

    Events Page: http://www.fitboxworld.com/find-an-event/
    Events //main cat
    – ALL // list all sub categories
    – FITBOXATHON
    – …

    Trainings Page: http://www.fitboxworld.com/find-a-training/
    Trainings // main
    – ALL // list all sub categories
    – FITBOX
    – ADVANCED
    – ….

    Thanks.

    in reply to: Change all labels in tribe search bar #1422917
    Daniel Gray
    Participant

    Worked like a charm.

    Here is the complete code:


    // Return event category name
    function evnt_name($depth){
    $cat = get_queried_object();
    $cat_type = $cat->name;
    return $cat_type;
    }

    // Translate labels in Events Calendar Pro search bar
    add_filter('gettext', 'theme_filter_text', 10, 3);

    function theme_filter_text( $translations, $text, $domain ) {
    $cat_type = evnt_name(2); // event category name
    // Copy and modify the following if {} statement to replace multiple blocks of text
    // Match the text you want you want to translate, preferably also match the text domain
    //echo "testing:".$text;
    if($text === '%s From' && $domain === 'the-events-calendar') {
    // The custom text you want instead
    $text = $cat_type.' from';
    }
    if($text === 'Near' && $domain === 'tribe-events-calendar-pro') {
    // The custom text you want instead
    $text = 'City, State or zip';
    }
    if($text === 'Search' && $domain === 'tribe-events-calendar') {
    // The custom text you want instead
    if($cat_type === "Classes"){
    $cat_type = "Class";
    }
    $text = 'Type of '.$cat_type;
    }
    if($text === 'Find %s' && $domain === 'the-events-calendar') {
    // The custom text you want instead
    $text = 'Find '.$cat_type;
    }
    return $text;
    }

    in reply to: Change all labels in tribe search bar #1422905
    Daniel Gray
    Participant

    Hello AndrĂ¡s,

    Worked like a charm.
    Here is the finished code along with the evnt_name() function in case it will help others:

    `// Return event category name
    function evnt_name($depth){
    $cat = get_queried_object();
    $cat_type = $cat->name;
    return $cat_type;
    }
    add_filter(‘gettext’, ‘theme_filter_text’, 10, 3);

    function theme_filter_text( $translations, $text, $domain ) {
    $cat_type = evnt_name(2); // event category name

    if($text === '%s From' && $domain === 'the-events-calendar') { 
        // The custom text you want instead
                $text = $cat_type.' from'; 
        }       
    if($text === 'Near' && $domain === 'tribe-events-calendar-pro') { 
        // The custom text you want instead
                $text = 'City, State or zip'; 
        }
    if($text === 'Search' && $domain === 'tribe-events-calendar') { 
        // The custom text you want instead
            if($cat_type === "Classes"){
        $cat_type = "Class";
    }
                $text = 'Type of '.$cat_type; 
        }
    if($text === 'Find %s' && $domain === 'the-events-calendar') { 
        // The custom text you want instead
                $text = 'Find '.$cat_type; 
        }
    
        return $text;
    

    }`

    • This reply was modified 8 years, 4 months ago by Daniel Gray.
    • This reply was modified 8 years, 4 months ago by Daniel Gray.
    • This reply was modified 8 years, 4 months ago by Leah.
Viewing 6 posts - 1 through 6 (of 6 total)