• Resolved ubivis

    (@ubivis)


    Hi Community, I do really hope you have a good idea ??

    The WordPress installation is running on a server with PHP 7.2.
    qtranslate is running quite well (with the standard fix for 7.1) so far, but I am having trouble with my theme (self made).

    In my functions.php I have the following script to always show the excerpt addition, even when the text is already small:

    function excerpt_more_link_all_the_time() {
    	// Remove More Link from get_the_excerpt()	
    	function more_link() {
    		return '';
    	}
    	add_filter('excerpt_more', 'more_link');
    	//Force read more link on all excerpts
    	function get_read_more_link() {
    		$excerpt = get_the_excerpt();
    		return $excerpt.' ...<br><br><a class="btn more_btn" href="'. get_permalink($post->ID) . '">Erfahre mehr</a>';
    	}
    	add_filter( 'the_excerpt', 'get_read_more_link' );
    	
    }

    I was now trying to make it multilinual by telling the script to either show “Read more” for English and “Erfahre mehr” for German.

    I tried:
    _e("<!--:en-->Read more<!--:--><!--:de-->Erfahre mehr<!--:-->")

    which did not work at this part of code (working fine on other parts of the template),
    and I tried:

    if (qtrans_getLanguage() == 'en') { $more = "Read more";}
    if (qtrans_getLanguage() == 'de') { $more = "Erfahre mehr";}
    return $excerpt.' ...<br><br><a class="btn more_btn" href="'. get_permalink($post->ID) . '">'.$more.'</a>';

    But this instantly raises an server error (Error 500).

    I also tried already to set up separate function.php files for each language, but calling then using qtrans_getLanguage() also ends up in Error 500.

    Anyone any idea?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘qtrans_getLanguage() raises error 500’ is closed to new replies.