Adding Button as Last Menu Item at Header
You can easily add the custom action button at right side of the header menu items via Astra Customizer.
- Go to Astra theme customier
- Click on the Header -> Primary Menu section
- Select “Button” from Last Item in Menu drop down
- Complete the settings as per your requirements.
I did this with small JavaScript code. You will install or create the astra child theme. So your all custom code will not remove when you will update the Astra theme.
I just add this code into the functions.php file of my astra child theme.
1 2 3 4 5 6 7 8 |
add_action( 'wp_footer', 'paulc_add_target_blank_ast_button' ); function paulc_add_target_blank_ast_button() { echo '<script type="text/javascript"> jQuery(document).ready(function(){ jQuery(".ast-custom-button-link").attr("target", "_blank"); }); </script>'."\n"; } |
After adding this code I am getting this new HTML markup for my header button.
Leave a Reply