Home / functions.php / Adding classes to previous_posts_link()
  • How to Adding classes to previous_posts_link()

    no thumbnail sorry: Adding classes to previous_posts_link()

    Adding this PHP code to the functions.php of your wordpress theme will add a class to your previous_posts_link() and next_posts_link().

    ( click code to copy )

    wordpress snippet : PHP

    <>
    add_filter('next_posts_link_attributes', 'posts_link_attributes');
    add_filter('previous_posts_link_attributes', 'posts_link_attributes');
    function posts_link_attributes(){
    	return 'class="styled-button"';
    }
    

    ( WordPress codex functions, hooks, in this snippet. )

    next_posts_link, previous_posts_link, add_filter,