Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #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)."'>&raquo;</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)."'>&laquo;</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

    #421954

    Hi 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ünter

    #421974

    thx Gunter, awesome.. please close topic!

    :)

    #422023

    Hi!

    Glad I could help you. Enjoy the theme and feel free to come back with further questions and/or problems you have.

    Cheers!
    Günter

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘custom function so I dont need to edit core’ is closed to new replies.