Kleo Code

This topic contains 4 replies, has 3 voices, and was last updated by  Kiran 6 years, 6 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #401096

    akia
    Buyer
    Post count: 35

    Kleo give you the following code to add to functions to be able to change the titles of the category sections, but it causes errors with geodirectory, I’ve found code on the forums searching but that doesn’t work ether. Can anyone help me with the correct one to use.

    
    
    //Add me to child theme functions.php
    function kleo_title()
    {
    	$output = "";
    
    	if ( is_category() )
    	{
    		$output = __('Archive for category:','kleo_framework')." ".single_cat_title('',false);
    	}
    	elseif (is_day())
    	{
    		$output = __('Archive for date:','kleo_framework')." ".get_the_time('F jS, Y');
    	}
    	elseif (is_month())
    	{
    		$output = __('Archive for month:','kleo_framework')." ".get_the_time('F, Y');
    	}
    	elseif (is_year())
    	{
    		$output = __('Archive for year:','kleo_framework')." ".get_the_time('Y');
    	}
    	elseif (is_search())
    	{
    		global $wp_query;
    		if(!empty($wp_query->found_posts))
    		{
    			if($wp_query->found_posts > 1)
    			{
    				$output =  $wp_query->found_posts ." ". __('search results for:','kleo_framework')." ".esc_attr( get_search_query() );
    			}
    			else
    			{
    				$output =  $wp_query->found_posts ." ". __('search result for:','kleo_framework')." ".esc_attr( get_search_query() );
    			}
    		}
    		else
    		{
    			if(!empty($_GET['s']))
    			{
    				$output = __('Search results for:','kleo_framework')." ".esc_attr( get_search_query() );
    			}
    			else
    			{
    				$output = __('To search the site please enter a valid term','kleo_framework');
    			}
    		}
    
    	}
    	elseif (is_author())
    	{
    		$curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
    		$output = __('Author Archive','kleo_framework')." ";
    
    		if(isset($curauth->nickname)) $output .= __('for:','kleo_framework')." ".$curauth->nickname;
    
    	}
    	elseif (is_tag())
    	{
    		$output = __('Tag Archive for:','kleo_framework')." ".single_tag_title('',false);
    	}
    	elseif(is_tax())
    	{
    		$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
    		$output = __('Archive for:','kleo_framework')." ".$term->name;
    
    	} elseif ( is_front_page() && !is_home() ) {
    					$output = get_the_title(get_option('page_on_front'));
    
    	} elseif ( is_home() && !is_front_page() ) {
    					$output = get_the_title(get_option('page_for_posts'));
    
    	} elseif ( is_404() ) {
    					$output = __('Error 404 - Page not found','kleo_framework');
    	}
    	else {
    		$output = get_the_title();
    	}
    
    	if (isset($_GET['paged']) && !empty($_GET['paged']))
    	{
    		$output .= " (".__('Page','kleo_framework')." ".$_GET['paged'].")";
    	}
    
    	return $output;
    }
    #401097

    Kor
    Moderator
    Post count: 16516

    Hi Matthew,

    We would need to check the backend. Please share WP temp admin access and I’ll forward this to a developer.

    Thanks!

    #401106

    Kiran
    Moderator
    Post count: 7069

    Hi Matthew,

    What error it shows on the page?

    FYI: We have already included function kleo_title() in our plugin via theme compatibility, so you do not need to include again.

    Thanks,
    Kiran

    #401123

    akia
    Buyer
    Post count: 35

    Ah thanks Kiran,

    I’ve managed to find it /wp-content/plugins/geodirectory/geodirectory-functions/compatibility and edit the bits i need.

    #401129

    Kiran
    Moderator
    Post count: 7069

    Thanks for letting us know 🙂

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

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

Open Support Ticket