Support » Plugin: AnsPress - Question and answer » Polylang Pro

  • Hi, there is little issue with Polylang. We can have multilingual website, for example for some product. But we can have forum, that is not dedicated to specify language. So forum is global. In settings of Polylang Pro there is section for Custom Post Types. I have unchecked these checkboxes for cpt “question” and “answer”. But in urls in listing of anspress there is lang. So now I have to use filter

    
    add_filter('ap_question_post_type_link', 'cns_ap_question_post_type_link_polylang_fix');
    function cns_ap_question_post_type_link_polylang_fix( $link ) {
    
        if ( function_exists( 'pll_default_language' ) ) {
            $default_lang = pll_default_language();
            return str_replace( '/' . $default_lang . '/', '/', $link );
        }
    
        return $link;
    }
    

    Another problem is localization of /page/ slug. There is

    ap_pagination( $paged, $answers->max_num_pages, ‘?ap_paged=%#%’, get_permalink( get_question_id() ) . ‘/page/%#%/’ );

    In czech language “page” is “strana”. It would be nice, if we can translate this slug.
    I have double slash => domain.cz/forum/answer//page/2/ which lead to 404. Without slash also not work.

    I have latest github version (2017-11-07). Thanks

    • This topic was modified 9 months, 1 week ago by  Hrohh.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Rahul Aryan

    (@nerdaryan)

    Hello,
    Let me check what I can do to disable lang prefix if not required.
    I will add a hook for filtering page.

    Can you tell me how I can reproduce same 404 error?

    Hrohh

    (@hrohh)

    In answer-loop.php there is on line 305

    ap_pagination( $paged, $answers->max_num_pages, '?ap_paged=%#%', get_permalink( get_question_id() ) . '/page/%#%/' );
    

    should be

    ap_pagination( $paged, $answers->max_num_pages, '?ap_paged=%#%', get_permalink( get_question_id() ) . 'page/%#%/' );
    

    Also please convert string “page” to i18n. Thanks!

    • This reply was modified 9 months ago by  Hrohh.
    Hrohh

    (@hrohh)

    another problem is in string “Posted %s” in templates/answer.php
    there is
    <?php printf( 'Posted %s', ap_human_time( ap_get_time( get_the_ID(), 'U' ) ) ); ?>
    should be
    printf(<time itemprop="datePublished" datetime="%1$s">%2$s</time>', ap_get_time( get_the_ID(), 'c' ), sprintf( __( 'Posted %s', 'anspress-question-answer' ), ap_human_time( ap_get_time( get_the_ID(), 'U' ) ) ));

    which is in templates/single-question.php

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Polylang Pro’ is closed to new replies.