lesterchan / wp-pagenavi

Adds a more advanced paging navigation interface to your WordPress blog.
https://wordpress.org/plugins/wp-pagenavi/
134 stars 49 forks source link

Add selected class #15

Closed icyflash closed 9 years ago

icyflash commented 9 years ago

Add selected class to current page number

Before:

<a class="page smaller" href="page/1">1</a>
<a class="page smaller"  href="page/2">2</a>

After:

<a class="page smaller" href="page/1">1</a>
<a class="page smaller selected"  href="page/2">2</a>
lesterchan commented 9 years ago

Why do you need it?

$i == $paged 

That will never get to the else. If it is the current page, the current will be as show below (the 8th page):

<div class="wp-pagenavi">
<span class="pages">Page 8 of 483</span>
<a class="first" href="http://lesterchan.net/">« First</a>
<a class="previouspostslink" rel="prev" href="http://lesterchan.net/page/7/">«</a>
<span class="extend">...</span>
<a class="page smaller" href="http://lesterchan.net/page/4/">4</a>
<a class="page smaller" href="http://lesterchan.net/page/5/">5</a>
<a class="page smaller" href="http://lesterchan.net/page/6/">6</a>
<a class="page smaller" href="http://lesterchan.net/page/7/">7</a>
<span class="current">8</span>
<a class="page larger" href="http://lesterchan.net/page/9/">9</a>
<a class="page larger" href="http://lesterchan.net/page/10/">10</a>
<a class="page larger" href="http://lesterchan.net/page/11/">11</a>
<a class="page larger" href="http://lesterchan.net/page/12/">12</a>
<a class="page larger" href="http://lesterchan.net/page/13/">13</a>
<span class="extend">...</span>
<a class="larger page" href="http://lesterchan.net/page/20/">20</a>
<a class="larger page" href="http://lesterchan.net/page/30/">30</a>
<a class="larger page" href="http://lesterchan.net/page/40/">40</a>
<span class="extend">...</span>
<a class="nextpostslink" rel="next" href="http://lesterchan.net/page/9/">»</a>
<a class="last" href="http://lesterchan.net/page/483/">Last »</a>
</div>
icyflash commented 9 years ago

I left page and current page setting empty, so didn't see the current class.

Just ignore this commit.