Tagged: pagination
-
AuthorPosts
-
April 1, 2015 at 3:23 pm #421944
Hi all,
I have modified a file for my client in core. This ofcourse is not what I want to do but I am not sure how I would get this in my childtheme functions.php. The function I modified is the avia_pagination in function-set-avia-frontend.php.
All I did is add a class to the next and previous page links, and comment out the numbered pages aswell as the go to last/first page buttons.
Anybody here know how to do this with a function? Any help appreciated as I want to be able to update smoothly :)
Here is what I modified:
$output .= "<$wrapper class='pagination'>"; $output .= ($paged < $pages && $showitems < $pages) ? "<a class='olderposts' href='".$method($next)."'>← Older posts</a>" :""; //$output .= ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) ? "<a href='".$method($pages)."'>»</a>":""; //$output .= "<span class='pagination-meta'>".sprintf(__("Page %d of %d", 'avia_framework'), $paged, $pages)."</span>"; //$output .= ($paged > 2 && $paged > $range+1 && $showitems < $pages)? "<a href='".$method(1)."'>«</a>":""; $output .= ($paged > 1 && $showitems < $pages)? "<a class='newerposts' href='".$method($prev)."'>Newer posts →</a>":""; $output .= "</$wrapper>\n";
Kind regards and keep up the good work! Soon enfold will be nr1!
Thomas
April 1, 2015 at 3:38 pm #421954Hi borkent!
Thank you for using our theme.
The best way to do is using a child theme.
In function.php of the child theme put:
if(!function_exists('avia_pagination')) { /** * Displays a page pagination if more posts are available than can be displayed on one page * @param string $pages pass the number of pages instead of letting the script check the gobal paged var * @return string $output returns the pagination html code */ function avia_pagination($pages = '', $wrapper = 'div') { // copy the original code inside and make your modifications here } function avia_post_pagination_link($link) { $url = preg_replace('!">$!','',_wp_link_page($link)); $url = preg_replace('!^<a href="!','',$url); return $url; } }
As functions.php of the child theme is loaded first the original functions will not be loaded and yours is used.
Cheers!
GünterApril 1, 2015 at 3:55 pm #421974thx Gunter, awesome.. please close topic!
:)
April 1, 2015 at 5:02 pm #422023 -
AuthorPosts
- The topic ‘custom function so I dont need to edit core’ is closed to new replies.