Support » Plugin: WP-PageNavi » Please change to code to suppert rtl

  • Hi

    Pls change the plugins code to correctly display the numbers on RTL as changing the float creates weird results when using different font sizes for link and current. Does not work ok that way.

    change

    				foreach ( range( $start_page, $end_page ) as $i ) {
    					if ( $i == $paged && !empty( $options['current_text'] ) ) {
    						$current_page_text = str_replace( '%PAGE_NUMBER%', number_format_i18n( $i ), $options['current_text'] );
    						$out .= "<span class='{$class_names['current']}'>$current_page_text</span>";
    						$timeline = 'larger';
    					} else {
    						$out .= $instance->get_single( $i, $options['page_text'], array(
    							'class' => "{$class_names['page']} {$class_names[$timeline]}",
    							'title' => sprintf( __( 'Page %d', 'wp-champion' ), number_format_i18n( $i ) ),
    						) );
    					}
    				}

    To this to have the numbering reversed on rtl layout.

    			if (is_rtl()) {
    				foreach ( range( $end_page, $start_page ) as $i ) {
    					if ( $i == $paged && !empty( $options['current_text'] ) ) {
    						$current_page_text = str_replace( '%PAGE_NUMBER%', number_format_i18n( $i ), $options['current_text'] );
    						$out .= "<span class='{$class_names['current']}'>$current_page_text</span>";
    						$timeline = 'larger';
    					} else {
    						$out .= $instance->get_single( $i, $options['page_text'], array(
    							'class' => "{$class_names['page']} {$class_names[$timeline]}",
    							'title' => sprintf( __( 'Page %d', 'wp-champion' ), number_format_i18n( $i ) ),
    						) );
    					}
    				}
    
    			} else
    			{
    				foreach ( range( $start_page, $end_page ) as $i ) {
    					if ( $i == $paged && !empty( $options['current_text'] ) ) {
    						$current_page_text = str_replace( '%PAGE_NUMBER%', number_format_i18n( $i ), $options['current_text'] );
    						$out .= "<span class='{$class_names['current']}'>$current_page_text</span>";
    						$timeline = 'larger';
    					} else {
    						$out .= $instance->get_single( $i, $options['page_text'], array(
    							'class' => "{$class_names['page']} {$class_names[$timeline]}",
    							'title' => sprintf( __( 'Page %d', 'wp-champion' ), number_format_i18n( $i ) ),
    						) );
    					}
    				}
    			}

    Thank you !

  • You must be logged in to reply to this topic.