Home > Mobile >  HTML in PHP Wordpress
HTML in PHP Wordpress

Time:07-21

I'm using this code below for my pagination in my custom wordpress theme. Now i want to change the "&rsaquo;" in FontAwesome Icon like "<i ></i>". But its not working.

What should i do?

function vario_numeric_posts_nav() {
      global $wp_query;
      if ( get_query_var( 'paged' ) ) {
      $paged = get_query_var( 'paged' );
      } elseif ( get_query_var( 'page' ) ) {
      $paged = get_query_var( 'page' );
      } else {
      $paged = 1;
      }
      if ( is_front_page() || is_home() || is_archive() || is_search() ) { ?>
      <div >
      <?php echo paginate_links( array(
      'base' => str_replace( 999999999, '%#%', esc_url( get_pagenum_link( 999999999 ) ) ),
      'total' => $wp_query->max_num_pages,
      'current' => $paged,
      'prev_text' => '<span aria-label="' . esc_attr__( 'Previous page', 'textdomain' ) . '">' . esc_html__( '&lsaquo;', 'textdomain' ) . '</span>',
      'next_text' => '<span aria-label="' . esc_attr__( 'Next page', 'textdomain' ) . '">' . esc_html__( '&rsaquo; ', 'textdomain' ) . '</span>'
      ) ); ?>
      </div>
      <?php }
      }

CodePudding user response:

Try replacing php part for the icon completely with the HTML like this:

function vario_numeric_posts_nav() {
      global $wp_query;
      if ( get_query_var( 'paged' ) ) {
      $paged = get_query_var( 'paged' );
      } elseif ( get_query_var( 'page' ) ) {
      $paged = get_query_var( 'page' );
      } else {
      $paged = 1;
      }
      if ( is_front_page() || is_home() || is_archive() || is_search() ) { ?>
      <div >
      <?php echo paginate_links( array(
      'base' => str_replace( 999999999, '%#%', esc_url( get_pagenum_link( 999999999 ) ) ),
      'total' => $wp_query->max_num_pages,
      'current' => $paged,
      'prev_text' => '<span aria-label="' . esc_attr__( 'Previous page', 'textdomain' ) . '"><i ></i></span>',
      'next_text' => '<span aria-label="' . esc_attr__( 'Next page', 'textdomain' ) . '"><i ></i></span>'
      ) ); ?>
      </div>
      <?php }
      }
  • Related