Thêm lớp vào các liên kết được tạo bởi next_posts_link và before_posts_link - Thủ thuật CSS

Anonim

Hai hàm này tạo ra các liên kết neo và bạn có thể tùy chỉnh rất nhiều trong số đó, nhưng không thể thêm một lớp chỉ bằng cách sử dụng các tham số của chúng. Gotta thêm một hàm vào functions.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"'; )