logo
Ask your WordPress questions! Pay money and get answers fast! (more info)

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.

$10
Wordpress Pagination

I have wordpress pagination working using:


<?php
global $wp_query;

$big = 999999999; // need an unlikely integer

echo paginate_links( array(
'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $wp_query->max_num_pages
) );
?>


the problem is the code is outputting single quotes instead of double quotes and so I can't style with css.

Example output:
<span class='page-numbers current'>1</span>
<a class='page-numbers' href='http://www.jules-photographer.com/articles/page/2/'>2</a>
<a class='page-numbers' href='http://www.jules-photographer.com/articles/page/3/'>3</a>
<a class='page-numbers' href='http://www.jules-photographer.com/articles/page/4/'>4</a>
<a class="next page-numbers" href="http://www.jules-photographer.com/articles/page/2/">Next &raquo;</a>


Any thoughts?

This question has been answered.

julesphoto | 01/26/12 at 11:37am Edit


(6) Possible Answers Submitted...

See a chronological view of answers?

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

  • avatar
    Last edited:
    01/26/12
    11:43am
    Luis Abarca says:

    You can styles, with single or double quotes.


    .page-numbers {
    /* your styles */
    }


    You can also wrap the pagination in a DIV

    <div id="pagination">
    <span class='page-numbers current'>1</span>
    <a class='page-numbers' href='http://www.jules-photographer.com/articles/page/2/'>2</a>
    <a class='page-numbers' href='http://www.jules-photographer.com/articles/page/3/'>3</a>
    <a class='page-numbers' href='http://www.jules-photographer.com/articles/page/4/'>4</a>
    <a class="next page-numbers" href="http://www.jules-photographer.com/articles/page/2/">Next &raquo;</a>


    </div>

    And add styles like this


    #pagination span {}
    #pagination a {}

    Previous versions of this answer: 01/26/12 at 11:43am | 01/26/12 at 11:43am

    • 01/26/12 11:52am

      Luis Abarca says:

      Yep, you can add styles, maybe yor styles are overwrited by other rules in your stylesheet, so you can use !important to check


      .page-numbers {
      color: #00f !important;
      }

      .page-numbers:hover {
      color: #f00 !important;
      }

  • avatar
    Last edited:
    01/26/12
    11:41am
    rizaljohn says:

    I don't think you can't add style on single quote. Do you have the link?

  • avatar
    Last edited:
    01/26/12
    11:42am
    Hai Bui says:

    Hi,

    It doesn't matter if it outputs single quotes or double quotes, you can add css styles either way.

  • avatar
    Last edited:
    01/26/12
    11:43am
    Ross Wilson says:

    Why can you not style this type of output. I was able to style your html here:
    http://jsfiddle.net/2Pf9c/

  • avatar
    Last edited:
    01/26/12
    11:45am
    John Cotton says:

    Hi Julian

    I never noticed that before, but you're absolutely right, that function mixes single and double quotes.

    But why does it stop you using css? A class attribute is a class attribute which you use....

    You could always wrap a str_replace or preg_replace around the function if you really wanted the consistency.

    • 01/26/12 11:54am

      julesphoto says:

      Wow another thing learned... I had no idea that you could style with either single or double quotes.. just rushed to the assumption that it was wrong. Still I would prefer if it was double quote to keep everything consistent. I have no idea how to wrap in the str_replace to format as I want.

  • avatar
    Last edited:
    01/26/12
    11:51am
    idt says:

    You can style regardless of single or double quotes.


    a.page-numbers{
    /* page number styles */
    }
    a.current {
    /* style for current page link */
    }
    a.next {
    /* Style for next page link */
    }



This question has expired.



Julio Potier had additional discourse to offer.

Gabriel Reguly, julesphoto, Julio Potier, Kannan C voted on this question.



Current status of this question: Completed



Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.