Forum Replies Created

Viewing 8 replies - 46 through 53 (of 53 total)
  • Thread Starter 916VT

    (@vincent916)

    Hi there,

    I finally managed to change it by using a new fr_FR.po.

    But I still can not change the comments.php template here :

    <?php
    printf( _nx( __( '1 Comment', 'my-theme' ), '%1$s Comments', get_comments_number(), 'comments title', 'my-theme' ),
    	number_format_i18n( get_comments_number() ), '<span>' . get_the_title() . '</span>' );
    ?>

    I don’t find how I can make the %1$s Comments ready for translation… There is no string here and I did not find a way to have one yet.

    Anyone can help ?

    Thanks a lot

    Thread Starter 916VT

    (@vincent916)

    Hi there,

    Finally, I added that part of code, from the link you sent, and adapted it and it works :

    function my_post_queries( $query ) {
      // do not alter the query on wp-admin pages and only alter it if it's the main query
      if (!is_admin() && $query->is_main_query()){
        // alter the query for the home and category pages
        if(is_home()){
          $query->set('posts_per_page', 3);
        }
        if(is_category()){
          $query->set('posts_per_page', 3);
        }
      }
    }
    add_action( 'pre_get_posts', 'my_post_queries' );

    I don’t know why but it works…

    Thanks a lot for helping !

    Thread Starter 916VT

    (@vincent916)

    I’m trying the different points from the link you sent but that’s a bit too much of php for me…

    Thread Starter 916VT

    (@vincent916)

    Hi keesiemeijer,

    Yes, I would like to have all ‘blog’ posts but, displayed by 5 per page (I set 2 only for trying pagination).

    BTW – I now set this template as category-blog.php but it’s still not working…

    Thread Starter 916VT

    (@vincent916)

    It’s embarrassing, your code works, mistake was mine, from another open tag on the template…
    I’m sorry about that and thank you again for your help ! 🙂

    Thread Starter 916VT

    (@vincent916)

    Actually, instead of sometimes, it’s more about 9 times on 10 that one element miss.

    Thread Starter 916VT

    (@vincent916)

    It works, well, as my first code.

    The number of elements displayed on .related is still, sometimes, one less than the posts_per_page…

    For example, when I check a post, it displays three, but if I reload, only two. And could be the opposite.

    Thread Starter 916VT

    (@vincent916)

    Hi alchymyth,
    Thanks for your answer.

    I tried to implement it but my first loop doesn’t use any query and I don’t how to change and make it works properly…

    I guess I need to change that line :

    <?php if (have_posts()) : while (have_posts()) :
      the_post(); $do_not_duplicate = $post->ID; ?>

    to that one :

    <?php $my_query = new WP_Query('category_name=featured&posts_per_page=2');
      while ($my_query->have_posts()) : $my_query->the_post();
      $do_not_duplicate[] = $post->ID ?>

    but without query and args as it’s a template for single.php.

    Can you give a hand ? 🙂
    Thanks a lot again !

Viewing 8 replies - 46 through 53 (of 53 total)