Results 1 to 1 of 1

Thread: viewing homepage pagination links for styling purposes

  1. #1
    Thread Starter
    Veteran almightyeric's Avatar
    Join Date
    Aug 2011
    Location
    Nothern CA, USA
    Posts
    416
    Thanks
    56
    Thanked 19 Times in 16 Posts

    viewing homepage pagination links for styling purposes

    I wanted to style the homepage pagination links on a site that only has 2 ads (i.e. not enough to cause the pagination links to appear naturally).

    So I modified some code inside ClassiPress to cause the pagination link to appear in all scenarios (even if there aren't enough ads to populate a second page). This way, I could style the link without creating a bunch of test ads.

    Here is how I did it:

    WARNING: This will break pagination! I recommend you remove this mod when you're done styling the pagination links.

    1. In tpl-ads-home.php, change lines 71-75 from this:

    PHP Code:
                            <?php
                                
    if ( $total_pages ) {
                            
    ?>
                                    <div class="paging"><a href="<?php echo $post_type_url?>"> <?php _e'View More Ads'APP_TD ); ?> </a></div>
                            <?php ?>
    To this (added "|| true" to the condition):

    PHP Code:
                            <?php
                                
    if ( $total_pages || true ) {
                            
    ?>
                                    <div class="paging"><a href="<?php echo $post_type_url?>"> <?php _e'View More Ads'APP_TD ); ?> </a></div>
                            <?php ?>
    2. In the same file, change lines 91-95 from this:

    PHP Code:
                                if ( $cp_has_next_page ) {
                                    $popular_url = add_query_arg( array( 'sort' => 'popular' ), $post_type_url );
                            ?>
                                    <div class="paging"><a href="<?php echo $popular_url?>"> <?php _e'View More Ads'APP_TD ); ?> </a></div>
                            <?php ?>
    To this (added "|| true" to the condition):

    PHP Code:
                                if ( $cp_has_next_page || true ) {
                                    $popular_url = add_query_arg( array( 'sort' => 'popular' ), $post_type_url );
                            ?>
                                     <div class="paging"><a  href="<?php echo $popular_url?>"> <?php _e'View More  Ads'APP_TD ); ?> </a></div>
                            <?php ?>
    3. In the same file, change lines 118-123 from this:

    PHP Code:
                            <?php
                                
    if ( $total_pages ) {
                                    
    $random_url add_query_arg( array( 'sort' => 'random' ), $post_type_url );
                            
    ?>
                                    <div class="paging"><a href="<?php echo $random_url?>"> <?php _e'View More Ads'APP_TD ); ?> </a></div>
                            <?php ?>
    To this (added "|| true" to the condition):

    PHP Code:
                            <?php
                                
    if ( $total_pages || true) {
                                    
    $random_url add_query_arg( array( 'sort' => 'random' ), $post_type_url );
                            
    ?>
                                    <div class="paging"><a href="<?php echo $random_url?>"> <?php _e'View More Ads'APP_TD ); ?> </a></div>
                            <?php ?>
    Done.

    Now your homepage will show the pagination link below the list of ads, and you can style it without creating a bunch of test ads.

    REMINDER: This will break pagination! I recommend you remove this mod when you're done styling the pagination links.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [TUTORIAL] While Viewing a Single Ad Use Next & Previous Navigation Links - ENHANCEMENT!
    By vienna in forum ClassiPress General Discussion
    Replies: 83
    Last Post: March 2nd, 2016, 03:58 PM
  2. How to remove viewing events on my Vantage 1.2.1 homepage
    By ashton25 in forum Vantage General Discussion (Legacy)
    Replies: 3
    Last Post: August 13th, 2013, 05:14 AM
  3. How to remove viewing events on my Vantage 1.2.1 homepage
    By ashton25 in forum Help Using Vantage (Legacy)
    Replies: 3
    Last Post: August 13th, 2013, 05:14 AM
  4. [SOLVED] Homepage and pagination 404
    By apollog in forum Report Vantage Bugs (Legacy)
    Replies: 3
    Last Post: July 15th, 2012, 03:19 PM
  5. Bottom pagination links on homepage not working
    By prservices in forum Report Clipper Bugs
    Replies: 1
    Last Post: June 9th, 2012, 09:24 AM