Forked from Firestorm-Graphics/foundation wp link pages
Created
July 10, 2012 08:03
-
-
Save Narga/3081949 to your computer and use it in GitHub Desktop.
custom wp_link_pages() for Foundation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
custom wp_link_pages() for Foundation 2 & 3; | |
//:::: Step 1 :::::: add the following to functions.php ::::::::::::::::::// | |
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::// | |
<?php | |
add_action( 'reverie_page_links', 'reverie_page_links', 10, 1 ); | |
/** | |
* Modification of wp_link_pages() for custom styling for foundation 2 & 3 by Zurb for use within wordpress. | |
* | |
* Please retain author links. | |
* | |
* @ author: Flickapix Dezign | |
* @ author url: http://dezign.flickapix.co.uk | |
* @ param array $args | |
* @ return void | |
*/ | |
function reverie_page_links( $args = array () ) | |
{ | |
$defaults = array( | |
'before' => '<ul class="pagination">', | |
'after' => '</ul>', | |
'link_before' => '', | |
'next_or_number' => 'number', | |
'link_after' => '', | |
'pagelink' => '%', | |
'echo' => 1, | |
'pages' => '<p class="pages">' . __('Pages','reverie').':</p>', | |
'current_first' => '<li class="current"><a href="">', | |
'current_last' => '</a></li>', | |
); | |
$r = wp_parse_args( $args, $defaults ); | |
$r = apply_filters( 'wp_link_pages_args', $r ); | |
extract( $r, EXTR_SKIP ); | |
global $page, $numpages, $multipage, $more, $pagenow; | |
if ( ! $multipage ) | |
{ | |
return; | |
} | |
$output = $before; | |
print $output . $pages; | |
for ( $i = 1; $i < ( $numpages + 1 ); $i++ ) | |
{ | |
$j = str_replace( '%', $i, $pagelink ); | |
$output .= ' '; | |
if ( $i != $page || ( ! $more && 1 == $page ) ) | |
{ | |
$output .= "<li>"; | |
$output .= _wp_link_page( $i ) . "{$link_before}{$j}{$link_after}</a>"; | |
$output .= "</li>"; | |
} | |
else | |
{ | |
$output .= "{$current_first}{$link_before}{$j}{$link_after}{$current_last}"; | |
} | |
} | |
print $output . $after; | |
} | |
?> | |
//:::: Step 2 :::::: add the following to loop-page.php ::::::::::::::::::// | |
//::::::::::::::::::: replacing wp_link_pages line ::::::::::::::::::::::// | |
<?php reverie_page_links(); ?> | |
//:::: Step 3 :::::: add the following to styles.css ::::::::::::::::::// | |
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::// | |
ul.pagination .pages { float: left; display: block; height: 24px; font-size: 15px; margin:4px 10px 0 5px;} | |
//::::::::::::::::: Thats it ! Enjoy native foundation pagination styling on pages ::::::::::::::::::::::::// |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
excellent, cant believe it took 7 months to notice your comment lol