GavickPro / Meet-GavernWP

Meet GavernWP is a responsive free Wordpress theme
35 stars 23 forks source link

Add classes to the prev/next image buttons on the attachment page #163

Closed dziudek closed 11 years ago

dziudek commented 11 years ago

Like here: http://wordpress.stackexchange.com/questions/77296/adding-class-to-next-prev-image-link-in-attachment-php

dziudek commented 11 years ago

Solution for the filters.php file:

/**
 *
 * Function used in the attachment page image links
 *
 * @return the additional class in the links
 *
 **/

function gavern_img_link_class( $link )
{
    $class = 'next_image_link' === current_filter() ? 'next' : 'prev';

    return str_replace( '<a ', '<a class="btn nav-'.$class.'"', $link );
}

add_filter( 'previous_image_link', 'gavern_img_link_class' );
add_filter( 'next_image_link',     'gavern_img_link_class' );
dziudek commented 11 years ago

Added: https://github.com/GavickPro/Meet-GavernWP/commit/64d3035fcde69244aac439bdba082ae7aec66fee