Hello,
I need to add a back button to the all posts
Hey Melanie,
There are some suggestions here, maybe one of them will work for you? https://wordpress.org/support/topic/a-working-back-to-previous-page
Best regards,
Jordan Shannon
Hello Jordan
Thank you for your answer, I just want to know where to put the following code to display it in all post
<button class=”button-back” onclick=”goBack()”>Go Back</button>
<script>
function goBack() {
window.history.back();
}
</script>
Hi,
Please provide admin info so we can look into this issue further.
Best regards,
Jordan Shannon
Sorry, I dont need the button in all the posts, I need the back button on the menu
Hi,
Okay, well you can add the code to header.php and then use css to position it from there.
Best regards,
Jordan Shannon
ok, I will try to do it and let you know thank you
Hi,
No problem!
Best regards,
Jordan Shannon
I found a solution
/*CUSTOM Menu back button*/
add_action( ‘wp_footer’, ‘tompai_back_button’ );
function tompai_back_button(){
?>
<script type = “text/javascript”>
jQuery(document).ready(function(){
jQuery(“#menu-item-3656 a”).attr(‘onclick’, ‘window.history.go(-1);’);
});
</script>
<?php
}
/* END CUSTOM BACK BUTTON*/
Hi mela1989,
Glad you got it working for you and thank you for sharing! :)
If you need further assistance please let us know.
Best regards,
Victoria