Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

To remove screen_reader_text coming in h2 from the_posts_pagination

Tags:

php

wordpress

I am using twentyfifteen theme and for pagination , i have used the_posts_pagination and want to remove h2 tag and text

I have tried but it just remove "Post navigation"text,not h2 tag

the_posts_pagination( array(
  'prev_text'          => __( ' ', 'twentyfifteen' ),
  'next_text'          => __( ' ', 'twentyfifteen' ),
  'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( '', 'twentyfifteen' ) . ' </span>',//Page
  'screen_reader_text' => __( '&nbsp;' )
) );

Pl help me. Thanks

like image 880
Bhumi Shah Avatar asked Mar 15 '15 16:03

Bhumi Shah


1 Answers

You mentioned wanting to remove the h2 tag and text. But for accessibility it is helpful to keep the h2 with class screen-reader-text. This WordPress article on accessibility shows how to hide the Post navigation text visually but keep it available to screen readers.

/* Text meant only for screen readers. */
.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  word-wrap: normal !important;
}
like image 64
philyawj Avatar answered Sep 18 '22 10:09

philyawj