How to insert WP previous_post_link (); anchored in a div

0

Good night, I'm trying to create a personalized navigation between single-posts in Wordpress, but I do not know how to do it, and I do not want to use a plugin for this, see what I'm trying to do (No No Success!):

* .php

<a href="<?php next_post_link();?>">
        <div  class="seta-next">
            <i></i>
        </div>
    </a>
    <a href="<?php previous_post_link(); ?>">
        <div class="seta-prev">
            <i></i>
        </div>
    </a>  

*. css

.seta-prev{ 
    padding:15px 20px; 
    border:6px solid #ccc; 
    border-radius:50px; 
    float:left; 
    margin:0 10px; 
    box-shadow: 0 0 4px rgba(0,0,0,0.7); 
    transition:all linear 0.2s; 
}
.seta-prev i{ 
    border-right: 20px solid #ccc; 
    border-top: 15px solid transparent;  
    border-bottom: 15px solid transparent; 
    float:left; 
}

.seta-prev:hover{
    transform: rotateX(180deg)
}

.seta-next{ 
    position: relative;
    padding:15px 20px; 
    border:6px solid #ccc; 
    border-radius:50px; 
    top: 50%;
    float:right; 
    margin:0 10px; 
    box-shadow: 0 0 4px rgba(0,0,0,0.7); 
    transition:all linear 0.2s; 
}
.seta-next i{ 
    border-left: 20px solid #ccc; 
    border-top: 15px solid transparent;  
    border-bottom: 15px solid transparent; float:left; 
}

.seta-next:hover{
    transform: rotateX(180deg)
}
    
asked by anonymous 15.09.2018 / 02:45

1 answer

0

I solved my problem people:

<?php $prev_post = get_previous_post(); ?>
<?php $next_post = get_next_post(); ?>
<a href="<?php echo esc_url( get_permalink( $prev_post->ID ) ); ?>">
      <div  class="seta-next">
        <i></i>
      </div>
</a>
<a href="<?php echo esc_url( get_permalink( $next_post->ID ) ); ?>">
      <div class="seta-prev">
        <i></i>
      </div>
</a>
    
15.09.2018 / 03:18