problems with GD home popular categories widget

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

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

Open Support Ticket
  • Author
    Posts
  • #326557

    Ding Hua
    Expired Member
    Post count: 152

    Hi,

    I got two problems.

    a) refer attached file , indicated with arrow , how to remove categories words from the selection.
    It is showing for all categories , make the text longer , not making any senses and annoying users.

    2) Only want to show some primary categories here. Do not want to show other categories.
    Refer picture , do not want to show the categories in the blue line . How to exclude them showing here ?
    Rgds,
    YC

    #326712

    Guust
    Moderator
    Post count: 29970

    You can remove “Categories” in the GD core language file.
    Look for

    %s Categories

    and change to

    %s

    There is no option to customize what CPTs are listed there, except deleting them.

    #326787

    Ding Hua
    Expired Member
    Post count: 152

    Hi,

    I only want to remove from home page drop down list.
    Will your suggestion remove categorizes keywords from the entire directory website or only home page widget drop down list ?

    Rgds,
    YC

    #326904

    Guust
    Moderator
    Post count: 29970

    My suggestion will remove “categories” from all CPT drop down lists in every instance of the GD Popular Categories widget.

    #326971

    Ding Hua
    Expired Member
    Post count: 152

    HI,

    Okay with 1st question.

    For the 2nd below question , why can’t I exclude in the drop down list ? I even can exclude any CPT from Map categories . There is option to exclude from Map for each CPT. Why there is no option from categories widget drop down list ?

    2) Only want to show some primary categories here. Do not want to show other categories.
    Refer picture , do not want to show the categories in the blue line . How to exclude them showing here ?

    Rgds,

    #326993

    Giri
    Expired Member
    Post count: 3155

    Hi Ding,

    I have added a filter in GD core to modify the output of that dropdown. It will be avilable in next release.

    In the meantime follow these steps

    You need to add this line

    $taxonomy = apply_filters('geodir_pp_category_taxonomy', $taxonomy);

    in

    wp-content/plugins/geodirectory/geodirectory-functions/general_functions.php

    Around line number 2770

    AFTER this code

    
    
           $taxonomy = array();
    	if ( ! empty( $gd_post_type ) ) {
    		$taxonomy[] = $gd_post_type . "category";
    	} else {
    		$taxonomy = geodir_get_taxonomies( $gd_post_type );
    	}
    

    Once you are done with that edit your child theme functions.php file and then add this code

    
    
    function exclude_gd_taxonomies($taxonomies) {
        $excluded_post_types =  array('gd_place', 'gd_job');
        foreach ($excluded_post_types as $ptype) {
            $cat = $ptype . "category";
            if(($key = array_search($cat, $taxonomies)) !== false) {
                unset($taxonomies[$key]);
            }
        }
        return $taxonomies;
    }
    add_filter('geodir_pp_category_taxonomy', 'exclude_gd_taxonomies');

    You can also provide me admin credentials. So I can apply them.

    Thanks

    #327458

    Ding Hua
    Expired Member
    Post count: 152

    Hi Giri,

    Thanks.

    I am using main theme Geo Directory Starter Theme.
    I don’t have child theme.
    I just need to modify Directory Starter Theme theme functions.php , right ?

    After adding this , where can I configure exclude CPT categories list ?

    Rgds,
    YC

    #327493

    Giri
    Expired Member
    Post count: 3155

    Hi Ding,

    Please use code snippets plugin to add custom codes.

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

    Just add the post types in this array.

    
    
    
    $excluded_post_types =  array('gd_place', 'gd_job');

    I have used gd_place and gd_job as an example.

    You can get the post type names in this page.

    wp-admin/admin.php?page=geodirectory&tab=geodir_manage_custom_posts

    Thanks

    #328196

    Ding Hua
    Expired Member
    Post count: 152

    Hi Giri,

    Thanks a lot.
    It works.

    Rgds,
    YC

    #328197

    Ding Hua
    Expired Member
    Post count: 152

    Pls include this in next release. Thanks.

    #328198

    Giri
    Expired Member
    Post count: 3155

    You are welcome.

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

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

Open Support Ticket