Support » Plugin: Falang multilanguage for WordPress » Read more option not appearing in translated posts

  • Hi, my default language is working fine but in translated language when I visit home page, I can see full posts. I had inserted Read More tag on each posts. There should be Read More button after certain paragraphs.

Viewing 7 replies - 16 through 22 (of 22 total)
  • Plugin Author sbouey

    (@sbouey)

    Hi,

    The filter is in 1.3.27

    $content = apply_filters( ‘falang_translate_post_content’, $content );

    if you didn’t change the function.php it should work i use the same name for the filter

    ps: i have see your site is completly translated now.

    Stéphane

    Thread Starter eSabthok

    (@esabthok)

    yes I am using version 1.3.27. And I had removed previously filter in function.php. So you mean now it should work without adding filter in function.php and in plugin? no need to add any filter? Then why is it not working in my site?

    Or I need to put the filter somewhere?

    Regarding my site translation most if the page was translated earlier too but default was in Nepali and now it is in English language with this plugin.

    Plugin Author sbouey

    (@sbouey)

    No you have to put back the code in function.php

    i have only add the filter in falang but this extra code need to be add in funcion.php of a child theme.

    Stéphane

    Thread Starter eSabthok

    (@esabthok)

    hi is this the correct code you gave me yesterday?

    $content = apply_filters( ‘falang_translate_post_content’, $content );

    Or I need to put the old code you provided me previously weeks ago?

    old code is

    function falang_translate_post_content($content){
        if ( preg_match( '/<!--more(.*?)?-->/', $content, $matches ) ) {
            if ( has_block( 'more', $content ) ) {
                // Remove the core/more block delimiters. They will be left over after $content is split up.
                $content = preg_replace( '/<!-- \/?wp:more(.*?) -->/', '', $content );
            }
    
            $_post = get_post();
    
            $output     = '';
    
            $content = explode( $matches[0], $content, 2 );
    
            if ( ! empty( $matches[1] ) ) {
                $more_link_text = strip_tags( wp_kses_no_null( trim( $matches[1] ) ) );
            }
    
            $output = $content[0];
    
            if ( count( $content ) > 1 ) {
                if ( ! empty( $more_link_text ) ) {
                    $output .= apply_filters( 'the_content_more_link', ' <a href="' . get_permalink( $_post ) . "#more-{$_post->ID}\" class=\"more-link\">$more_link_text</a>", $more_link_text );
                }
            }
            $output = force_balance_tags( $output );
            return $output;
    
        }
        return $content;
    }
    
    add_filter('falang_translate_post_content','falang_translate_post_content');

    With new code, nothing happens but with old code, full posts are not appearing on the home page, but readers will misunderstand it as full posts because read more .text does not appear in the page break area. It looks like short and incomplete posts It looks like the end of the post.

    Please let me know which code should I use. I use both code one after another and both code together too, But still cant see Read more option.

    Here is how it look in the original and translated one. link to images

    Thread Starter eSabthok

    (@esabthok)

    And one more important thing I forget to mention, when I add this code in function.php, My posts only appear portion above the page break in all homepage, categories, and in single posts too. looks like that’s the end of the article, You can check my site and compare the English and Nepali post. Maybe you won’t understand but you can see the length of the posts.

    Looks like there is some error in the code you provided me. Is it possible to provide me the code again? thank you

    Hi there. I’m encountering the same issue. I put the code in the functions.php file of my child theme and even if it solves the problem, it makes the “continue reading” button disappear… any news about the fix?

    Oh and another thing. Besides the “continue reading” buttun not showing, the articles only show one paragraph. The rest of the content is completely lost. That’s a very bad issue…

Viewing 7 replies - 16 through 22 (of 22 total)
  • You must be logged in to reply to this topic.