Forum Replies Created

Viewing 15 replies - 1 through 15 (of 59 total)
  • Thread Starter eSabthok

    (@esabthok)

    Hi, thank your for your reply. I began to receive those emails after this post. But when I click to unlock it says invalid key. When I checked the time email was send it was more than 1 hour ago and it expires in 30 min.

    I am still locked out. I tried to get unlock email but received after 1 hour each time. And I used to receive successful login emails after 2-5 hours. Is there any issue with the plugin? How to solve this issue?

    Thread Starter eSabthok

    (@esabthok)

    As i am using translating plugin if I create a post in only 1 language, that means I did not translate it or did not create in another language. So technically I cant say the posts does not exists. But posts only exist in another language.

    As I have to click create a new post and choose the languages I want to write in. And in some post I am choosing only Nepali or English languages. But the plugin is creating the sitemap for both languages automatically.

    So, for this issue, only solution is: I have to wait until Falang is supported by rank maths? Or is there any way I can manually remove those sitemaps?

    Thread Starter eSabthok

    (@esabthok)

    Thank you. It is working now. Is it possible to change the the priority for each ad block instead of plugin?

    For example I choose 3 different ads to show after content and placed in each block separately so that they appear immediately after content, after WordPress related post and after other related post as in my site.

    All ads will be shown after content but they appear in different position.

    Thread Starter eSabthok

    (@esabthok)

    Hi, I have enabled remote debugging. Please have a look at it.

    Thread Starter eSabthok

    (@esabthok)

    Hi, Its fixed now. The correct code is as below in case needed in future for similar issue.

    //see wp-includes/post-template.php
    //function falang_translate_post_content_old($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 );
    //        }
    //
    //        $more_link_text = sprintf(
    //            '<span aria-label="%1$s">%2$s</span>',
    //            sprintf(
    //            /* translators: %s: Post title. */
    //                __( 'Continue reading %s' ),
    //                the_title_attribute(
    //                    array(
    //                        'echo' => false,
    //                        'post' => $_post,
    //                    )
    //                )
    //            ),
    //            __( '(more&hellip;)' )
    //        );
    //
    //
    //        $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;
    //}
    
    function falang_translate_post_content($content){
        global $page, $more, $preview, $pages, $multipage;
    
        global $post;
        $more_link_text = null;
    
        $_post = get_post( $post );
    
        if ( ! ( $_post instanceof WP_Post ) ) {
            return '';
        }
    
        // Use the globals if the $post parameter was not specified,
        // but only after they have been set up in setup_postdata().
        if ( null === $post && did_action( 'the_post' ) ) {
            $elements = compact( 'page', 'more', 'preview', 'pages', 'multipage' );
        } else {
            $elements = generate_postdata( $_post );
        }
    
        if ( null === $more_link_text ) {
            $more_link_text = sprintf(
                '<span aria-label="%1$s">%2$s</span>',
                sprintf(
                /* translators: %s: Post title. */
                    __( 'Continue reading %s' ),
                    the_title_attribute(
                        array(
                            'echo' => false,
                            'post' => $_post,
                        )
                    )
                ),
                __( '(more&hellip;)' )
            );
        }
    
        $output     = '';
        $has_teaser = false;
    
        // If post password required and it doesn't match the cookie.
        if ( post_password_required( $_post ) ) {
            return get_the_password_form( $_post );
        }
    
        // If the requested page doesn't exist.
        if ( $elements['page'] > count( $elements['pages'] ) ) {
            // Give them the highest numbered page that DOES exist.
            $elements['page'] = count( $elements['pages'] );
        }
    
        $page_no = $elements['page'];
        //  $content = $elements['pages'][ $page_no - 1 ];
        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 );
            }
    
            $content = explode( $matches[0], $content, 2 );
    
            if ( ! empty( $matches[1] ) && ! empty( $more_link_text ) ) {
                $more_link_text = strip_tags( wp_kses_no_null( trim( $matches[1] ) ) );
            }
    
            $has_teaser = true;
        } else {
            $content = array( $content );
        }
    
        if ( false !== strpos( $_post->post_content, '<!--noteaser-->' ) && ( ! $elements['multipage'] || 1 == $elements['page'] ) ) {
            $strip_teaser = true;
        }
    
        $teaser = $content[0];
    
        if ( $elements['more'] && $strip_teaser && $has_teaser ) {
            $teaser = '';
        }
    
        $output .= $teaser;
    
        if ( count( $content ) > 1 ) {
            if ( $elements['more'] ) {
                $output .= '<span id="more-' . $_post->ID . '"></span>' . $content[1];
            } else {
                if ( ! empty( $more_link_text ) ) {
    
                    /**
                     * Filters the Read More link text.
                     *
                     * @since 2.8.0
                     *
                     * @param string $more_link_element Read More link element.
                     * @param string $more_link_text    Read More 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;
    }
    
    add_filter('falang_translate_post_content','falang_translate_post_content');
    

    Thank you very much. Finally solved this problem. Thank you

    Thread Starter eSabthok

    (@esabthok)

    Hi have added add_filter(‘falang_translate_post_content’,’falang_translate_post_content’); but still I can not see the read more option, another user gave me code provide by you as per his reply and that code looks completely different on first half but I got php error for one line which is: ‘<span aria-label=”%1$s”>%2$s</span>’,

    He just paste it outside the code box so not sure if that was the actual code he wants to provide or not andd the code provided by him is this.

    //see wp-includes/post-template.php
    //function falang_translate_post_content_old($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 );
    // }
    //
    // $more_link_text = sprintf(
    // ‘<span aria-label=”%1$s”>%2$s</span>’,
    // sprintf(
    // /* translators: %s: Post title. */
    // __( ‘Continue reading %s’ ),
    // the_title_attribute(
    // array(
    // ‘echo’ => false,
    // ‘post’ => $_post,
    // )
    // )
    // ),
    // __( ‘(more…)’ )
    // );
    //
    //
    // $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’, ‘ ID}\” class=\”more-link\”>$more_link_text“, $more_link_text );
    // }
    // }
    // $output = force_balance_tags( $output );
    // return $output;
    //
    // }
    // return $content;
    //}
    
    function falang_translate_post_content($content){
    global $page, $more, $preview, $pages, $multipage;
    
    global $post;
    $more_link_text = null;
    
    $_post = get_post( $post );
    
    if ( ! ( $_post instanceof WP_Post ) ) {
    return ”;
    }
    
    // Use the globals if the $post parameter was not specified,
    // but only after they have been set up in setup_postdata().
    if ( null === $post && did_action( ‘the_post’ ) ) {
    $elements = compact( ‘page’, ‘more’, ‘preview’, ‘pages’, ‘multipage’ );
    } else {
    $elements = generate_postdata( $_post );
    }
    
    if ( null === $more_link_text ) {
    $more_link_text = sprintf(
    ‘<span aria-label=”%1$s”>%2$s</span>’,
    sprintf(
    /* translators: %s: Post title. */
    __( ‘Continue reading %s’ ),
    the_title_attribute(
    array(
    ‘echo’ => false,
    ‘post’ => $_post,
    )
    )
    ),
    __( ‘(more…)’ )
    );
    }
    
    $output = ”;
    $has_teaser = false;
    
    // If post password required and it doesn’t match the cookie.
    if ( post_password_required( $_post ) ) {
    return get_the_password_form( $_post );
    }
    
    // If the requested page doesn’t exist.
    if ( $elements[‘page’] > count( $elements[‘pages’] ) ) {
    // Give them the highest numbered page that DOES exist.
    $elements[‘page’] = count( $elements[‘pages’] );
    }
    
    $page_no = $elements[‘page’];
    // $content = $elements[‘pages’][ $page_no – 1 ];
    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 );
    }
    
    $content = explode( $matches[0], $content, 2 );
    
    if ( ! empty( $matches[1] ) && ! empty( $more_link_text ) ) {
    $more_link_text = strip_tags( wp_kses_no_null( trim( $matches[1] ) ) );
    }
    
    $has_teaser = true;
    } else {
    $content = array( $content );
    }
    
    if ( false !== strpos( $_post->post_content, ‘<!–noteaser–>’ ) && ( ! $elements[‘multipage’] || 1 == $elements[‘page’] ) ) {
    $strip_teaser = true;
    }
    
    $teaser = $content[0];
    
    if ( $elements[‘more’] && $strip_teaser && $has_teaser ) {
    $teaser = ”;
    }
    
    $output .= $teaser;
    
    if ( count( $content ) > 1 ) {
    if ( $elements[‘more’] ) {
    $output .= ‘<span id=”more-‘ . $_post->ID . ‘”></span>’ . $content[1];
    } else {
    if ( ! empty( $more_link_text ) ) {
    
    /**
    * Filters the Read More link text.
    *
    * @since 2.8.0
    *
    * @param string $more_link_element Read More link element.
    * @param string $more_link_text Read More text.
    */
    $output .= apply_filters( ‘the_content_more_link’, ‘ ID}\” class=\”more-link\”>$more_link_text“, $more_link_text );
    }
    $output = force_balance_tags( $output );
    }
    }
    
    return $output;
    }
    
    add_filter(‘falang_translate_post_content’,’falang_translate_post_content’);

    sorry to disturb you @fabykennedy , with the code provided by you I am getting PHP error again. It shows an error for one line which I have pasted below in bold.

    ‘<span aria-label=”%1$s”>%2$s</span>’,

    Could you please paste the exact code into the code box?

    Thread Starter eSabthok

    (@esabthok)

    With this code there is no php error but still read more button is not appearing. I cleared caches, cookies but it did not work.

    Just need to confirm: I put above code in function.php of my child theme and did not put any filter in falang plugin as you mentioned previously with new release no need to add filter in plugin we only have to add code in function.php.

    Please let me know the steps and code to fix this issue. I am using the Generatepress theme. I am losing my hope to fix this issue.

    Thank you both for providing the code but none of them work for me. There is no error in Code provided by Sbouey but still read more button is not appering.

    And code provided by @fabykennedy is showing php error. Could you please provide me the exact code using CODE tag.

    I am confused how come codes provided by both of you are different for the same purpose, there should be one correct code to fix specific issues. I am hopeless now.

    Hi Fabykennedy, I am still having this issue and saw that the code provided by the team is working for your site. Could you please me the full code you inserted in your function.php?

    This is the code provided to me and it does not show any read more button instead shows full posts.

    Thanks in advance.

    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;
    }
    
    Thread Starter eSabthok

    (@esabthok)

    I just inserted this code and do not see any error but still cannot see the read more button in the posts. Could you please check the link

    I have seen the concern of another person as well in this thread and another thread. Let me ask him how he fixed it and the actual code if that worked for him.

    Thread Starter eSabthok

    (@esabthok)

    I deleted / before ” from line 42 but still having the same PHP error. Could you please provide me the full correct code?

    Thread Starter eSabthok

    (@esabthok)

    Hi, why I am not getting any reply? I am stuck in this read more option and Its been a month I was waiting for the response. Could you please provide me the exact code to fix this issue? Thankyou

    Thread Starter eSabthok

    (@esabthok)

    Hi, I followed the link you have provided and inserted both of the codes in function.php, and still, I am having the same issues as before. And with the first code in that thread, I got the error in funchtion.php and the whole code saved before including the theme’s default code got rolled over( deleted) that’s the worst part.

    when using this code I got PHP error and all previous codes were deleted. Screenshot

    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>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');

    And when I use the second code provided by you in that thread, I don’t see the read more post, and posts after read more section are hidden, I can’t see the remaining portion of posts after read more section, Once the code is deleted I can see the full posts but no read more option with both codes.

    second code

    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');

    Could you please provide me with the exact code for which one is working? Because I only saw 2 codes over there and both are not working. If we need to do some modification to the code please let me know or please provide me the final code after doing modifications. Thank you

Viewing 15 replies - 1 through 15 (of 59 total)