Grow your CSS skills. Land your dream job.

arabic pagination … how ??

  • # January 27, 2012 at 4:43 am

    ?php

    /* Function that Rounds To The Nearest Value.
    Needed for the pagenavi() function */
    function round_num($num, $to_nearest) {
    /*Round fractions down (http://php.net/manual/en/function.floor.php)*/
    return floor($num/$to_nearest)*$to_nearest;
    }

    /* Function that performs a Boxed Style Numbered Pagination (also called Page Navigation).
    Function is largely based on Version 2.4 of the WP-PageNavi plugin */
    function pagenavi($before = '', $after = '') {
    global $wpdb, $wp_query;
    $pagenavi_options = array();
    $pagenavi_options = ('Page %CURRENT_PAGE% of %TOTAL_PAGES%:');
    $pagenavi_options = '%PAGE_NUMBER%';
    $pagenavi_options = '%PAGE_NUMBER%';
    $pagenavi_options = ('First Page');
    $pagenavi_options = ('Last Page');
    $pagenavi_options = 'Next »';
    $pagenavi_options = '« Previous';
    $pagenavi_options = '...';
    $pagenavi_options = '...';
    $pagenavi_options = 5; //continuous block of page numbers
    $pagenavi_options = 0;
    $pagenavi_options = 0;
    $pagenavi_options = 5;

    //If NOT a single Post is being displayed
    /*http://codex.wordpress.org/Function_Reference/is_single)*/
    if (!is_single()) {
    $request = $wp_query->request;
    //intval — Get the integer value of a variable
    /*http://php.net/manual/en/function.intval.php*/
    $posts_per_page = intval(get_query_var('posts_per_page'));
    //Retrieve variable in the WP_Query class.
    /*http://codex.wordpress.org/Function_Reference/get_query_var*/
    $paged = intval(get_query_var('paged'));
    $numposts = $wp_query->found_posts;
    $max_page = $wp_query->max_num_pages;

    //empty — Determine whether a variable is empty
    /*http://php.net/manual/en/function.empty.php*/
    if(empty($paged) || $paged == 0) {
    $paged = 1;
    }

    $pages_to_show = intval($pagenavi_options);
    $larger_page_to_show = intval($pagenavi_options);
    $larger_page_multiple = intval($pagenavi_options);
    $pages_to_show_minus_1 = $pages_to_show - 1;
    $half_page_start = floor($pages_to_show_minus_1/2);
    //ceil — Round fractions up (http://us2.php.net/manual/en/function.ceil.php)
    $half_page_end = ceil($pages_to_show_minus_1/2);
    $start_page = $paged - $half_page_start;

    if($start_page < = 0) {
    $start_page = 1;
    }

    $end_page = $paged + $half_page_end;
    if(($end_page - $start_page) != $pages_to_show_minus_1) {
    $end_page = $start_page + $pages_to_show_minus_1;
    }
    if($end_page > $max_page) {
    $start_page = $max_page - $pages_to_show_minus_1;
    $end_page = $max_page;
    }
    if($start_page < = 0) {
    $start_page = 1;
    }

    $larger_per_page = $larger_page_to_show*$larger_page_multiple;
    //round_num() custom function - Rounds To The Nearest Value.
    $larger_start_page_start = (round_num($start_page, 10) + $larger_page_multiple) - $larger_per_page;
    $larger_start_page_end = round_num($start_page, 10) + $larger_page_multiple;
    $larger_end_page_start = round_num($end_page, 10) + $larger_page_multiple;
    $larger_end_page_end = round_num($end_page, 10) + ($larger_per_page);

    if($larger_start_page_end - $larger_page_multiple == $start_page) {
    $larger_start_page_start = $larger_start_page_start - $larger_page_multiple;
    $larger_start_page_end = $larger_start_page_end - $larger_page_multiple;
    }
    if($larger_start_page_start < = 0) {
    $larger_start_page_start = $larger_page_multiple;
    }
    if($larger_start_page_end > $max_page) {
    $larger_start_page_end = $max_page;
    }
    if($larger_end_page_end > $max_page) {
    $larger_end_page_end = $max_page;
    }
    if($max_page > 1 || intval($pagenavi_options) == 1) {
    /*http://php.net/manual/en/function.str-replace.php */
    /*number_format_i18n(): Converts integer number to format based on locale (wp-includes/functions.php*/
    $pages_text = str_replace("%CURRENT_PAGE%", number_format_i18n($paged), $pagenavi_options);
    $pages_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $pages_text);
    echo $before.''.$after."n";
    }
    }
    }
    ?>

    this code give us a pagination for pages in WordPress , but it is for Left to right languages .
    i need to modify this to make implement a proper pagination for Arabic language .

    here is what iam looking for … ( image )

    any suggestion here … ?

    # January 27, 2012 at 10:25 am

    help please

    # January 30, 2012 at 3:50 pm

    any help please

    # January 30, 2012 at 10:35 pm

    Hi dagash, please don’t post the same question multiple times. I posted in the other thread about looking for wordpress plugin help in the WordPress forums.

    But maybe the fix you need could be css based? Did you look in the css for the definition for “a.single_page”, maybe just making it “float:right” would work? or maybe set the page direction to RTL?

    # January 31, 2012 at 1:12 am

    Have you tried just a basic direction:rtl; in the css? Sorry if it is obvious, just wondering if it’d work.

    # January 31, 2012 at 12:30 pm

    The other thread has now been deleted. Please do not double post.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".