<?php
global $post;
$previous = ( is_attachment() ) ? get_post( $post->post_parent ) : get_adjacent_post( false, '', true );
$next     = get_adjacent_post( false, '', false );
if ( ! $next && ! $previous ) {
    return;
}
$next_post = get_next_post();
$previous_post = get_previous_post();

if ( ! empty( $settings['link']['url'] ) ) {
    $widget->add_render_attribute( 'link_text', 'href', $settings['link']['url'] );

    if ( $settings['link']['is_external'] ) {
        $widget->add_render_attribute( 'link_text', 'target', '_blank' );
    }

    if ( $settings['link']['nofollow'] ) {
        $widget->add_render_attribute( 'link_text', 'rel', 'nofollow' );
    }
}

if( !empty($next_post) || !empty($previous_post) ) { ?>
    <div class="pxl-pagination1">
        <div class="pxl--item item--prev">
            <?php if ( is_a( $previous_post , 'WP_Post' ) && get_the_title( $previous_post->ID ) != '') { ?>
                <div class="pxl-item-icon pxl-icon-prev pxl-mr-20">
                    <a class="pxl-icon-link" href="<?php echo esc_url(get_permalink( $previous_post->ID )); ?>">
                        <svg version="1.2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
                            <title>arrow-right</title>
                            <style>
                                .arrow-right { fill: none;stroke: #000000;stroke-linecap: round;stroke-linejoin: round;stroke-width: 2 } 
                            </style>
                            <path fill-rule="evenodd" class="arrow-right" d="m5 12h14"/>
                            <path fill-rule="evenodd" class="arrow-right" d="m12 5l7 7-7 7"/>
                        </svg>
                    </a>
                </div>
                <div class="pxl-title-inner pxl-item-prev-title">
                    <a href="<?php echo esc_url(get_permalink( $previous_post->ID )); ?>"><span><?php echo esc_html($settings['previous_title']); ?></span></a>
                </div>
            <?php } ?>
        </div>
        <div class="pxl-item-dot">
            <a class="pxl-dot-link" <?php pxl_print_html($widget->get_render_attribute_string( 'link_text' )); ?>>
            </a>
            <div class="pxl-dot dot-bt">
                <span></span>
                <span></span>
            </div>
            <div class="pxl-dot">
                <span></span>
                <span></span>
            </div>
        </div>
        <?php if ( is_a( $next_post , 'WP_Post' ) && get_the_title( $next_post->ID ) != '') { ?>
            <div class="pxl--item item--next">
                <div class="pxl-title-inner pxl-item-next-title">
                    <a href="<?php echo esc_url(get_permalink( $next_post->ID )); ?>"><span><?php echo esc_html($settings['next_title']); ?></span></a>
                </div>
                <div class="pxl-item-icon pxl-icon-next pxl-ml-20">
                    <a class="pxl-icon-link" href="<?php echo esc_url(get_permalink( $next_post->ID )); ?>">
                        <svg version="1.2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
                            <title>arrow-right</title>
                            <style>
                                .arrow-right { fill: none;stroke: #000000;stroke-linecap: round;stroke-linejoin: round;stroke-width: 2 } 
                            </style>
                            <path fill-rule="evenodd" class="arrow-right" d="m5 12h14"/>
                            <path fill-rule="evenodd" class="arrow-right" d="m12 5l7 7-7 7"/>
                        </svg>
                    </a>
                </div>
            </div>
        <?php } ?>

    </div>
<?php } ?>