Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter morten66

    (@morten66)

    Ok. Problem solved, by dirty solution, but it works, just placed IF statement inside pagination code :

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    	query_posts(array(
    		'post_type'      => 'post', // You can add a custom post type if you like
    		'paged'          => $paged,
    		'posts_per_page' => 10
    	));
    	$currentlang = get_bloginfo('language');
    	if ($currentlang == 'en-US') { query_posts($query_string . '&cat=3'); };
    	if ($currentlang == 'de-DE') { query_posts($query_string . '&cat=56'); };
    	if ($currentlang == 'nn-NO') { query_posts($query_string . '&cat=58'); };
    ?>

    … and called pagination function between endwhile and else but before wp_reset_query();

    <?php endwhile ?>
    	<div class = "center pagin-mrg"><?php my_pagination(); ?></div>
     <?php else : ?>
    	<p><?php __('Sorry, this page does not exist.'); ?></p>
     <?php endif; wp_reset_query(); wp_reset_postdata(); ?>

    Just post this if someone will need it in the future.
    If some one know how to do this in function or correctly, please add your solution.

    Thank You.
    Morten66

    Thread Starter morten66

    (@morten66)

    Thank you Chouby for so fast and good answer:) You are amazing programmer! You just gave me what i needed, i’ve search for simpler solution, but this works even better 🙂

    This line of code gave me possibility to add bootstrap classes for button languages: printf('<div class = "%s" ><a href = "%s" >%s</a></div>' so you understood my problem very well 🙂

    I have just added (array(‘raw’ => 1));

    Here is the code if someone will be searching for this solution:

    <?php $languages = pll_the_languages(array('raw' => 1));
    foreach ($languages as $language){
    printf('<div class = "%s"><a href = "%s" class="btn btn-default lang-btn">%s</a></div>',
    'lang-' . $language['slug'],
    $language['url'],
    strtoupper($language['slug']
    );
    }
    ?>

    Thank You Chouby one more time:) Your plugin is so wonderful!
    Best Regards
    Morten

    Thread Starter morten66

    (@morten66)

    Thank you very much for the answer Chouby, i have more questions, is there a way to call some function which give me a separate links for languages without using foreach instruction in pll_the languages ?

    I want to use Bootstrap button classes for buttons of language switcher, so most simple solution for me is to use some function which returns separate links for each language. Is it possible to do that with functions of your plugin?

    Thank you very much for help 🙂

Viewing 3 replies - 1 through 3 (of 3 total)