samedi 21 mai 2016

Need Help Modifying a WP Page/Post Slider Plugin to go to Unique Page at End

I'm using the Theia Post Slider and I was hoping someone could look at this part of the plugin's code to tell me which part I can modify to get it to go to a unique url at the end.

I tried entering it in place of the $url in this part:

$button = '<a href="' . $url . '" class="_button _' . $directionName . $class . '">' . $html . '</a>';

But it didn't work. It looks like it should.

I'd like to just remove the part about checking if there's another post and just have it go straight to the URL but I'm not sure how to do it (beyond my php skill set).

Here's the rest of that section of code the part I modified was near the bottom:

    /*
 * Get a button for a navigation bar.
 * @param direction boolean False = prev; True = next;
 */
public static function get_navigation_barButton( $options, $direction ) {
    global $page, $pages;

    $directionName = $direction ? 'next' : 'prev';
    $url           = TpsMisc::get_post_page_url( $options['currentSlide'] + ( $direction ? 1 : - 1 ) );
    $leftText      = null;
    $rightText     = null;

    // Check if there isn't another page but there is another post.
    $urlIsAnotherPost = ! $url && $options[ $directionName . 'PostUrl' ];
    if ( $urlIsAnotherPost ) {
        $url = $options[ $directionName . 'PostUrl' ];
    }

    // Check what text we should display on the buttons.
    if ( TpsOptions::get( 'post_navigation' ) && ( ( $direction == false && $page == 1 ) || ( $direction == true && $page == count( $pages ) ) ) ) {
        $buttonText = TpsOptions::get( $directionName . '_text_post' );
    } else {
        $buttonText = TpsOptions::get( $directionName . '_text' );
    }

    switch ( TpsOptions::get( 'theme_type' ) ) {
        case 'font':
            $text  = $directionName == 'next' ? TpsOptions::get_font_icon( 'right' ) : TpsOptions::get_font_icon( 'left' );
            $width = 0;

            if ( $directionName == 'next' ) {
                $leftText = $buttonText;
            } else {
                $rightText = $buttonText;
            }
            break;

        case 'classic':
            $text      = $buttonText;
            $leftText  = '';
            $rightText = '';

            if ( $urlIsAnotherPost ) {
                $width = TpsOptions::get( 'button_width_post' );
            } else {
                $width = TpsOptions::get( 'button_width' );
            }
            break;

        default:
            return '';
    }

    $style = $width == 0 ? '' : 'style="width: ' . $width . 'px"';

    $htmlPart1 = '<span class="_1">' . $leftText . '</span><span class="_2" ' . $style . '>';
    $htmlPart2 = '</span><span class="_3">' . $rightText . '</span>';

    // HTML
    $html = $htmlPart1 . $text . $htmlPart2;
    $class = $urlIsAnotherPost ? ' _another_post' : '';
    if ( $url ) {
        $button = '<a href="' . $url . '" class="_button _' . $directionName . $class . '">' . $html . '</a>';
    } else {
        $button = '<span class="_button _' . $directionName . $class . ' _disabled">' . $html . '</span>';
    }

    return $button;
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire