• Michael Levy

    (@eruna_msl)


    Below is some code I added to the theme functions file.
    It is intended to switch the content if Spanish translation was selected.

    It works for the main content area, but gives every page in the navigation the title of the current page. The navigation is generated with wp_list_pages().

    Anyone know how to fix that problem?

    if(find_language()=='es'){
    	add_filter('the_content','spanish_content');
    	add_filter('the_title','spanish_title');
    }
    
    function spanish_title($title){
    
    	$spanish=get_post_meta(get_the_id(), 'spanish_title');
    	$span= $spanish[0];
    	if(strlen($span)<1){
    		return $title;
    	}
    	return $span;
    
    }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Adding filter to the title’ is closed to new replies.