Created
July 23, 2023 05:35
-
-
Save mdibrahimk48/50091ebeb84e8b2ca8e2daec587cdc48 to your computer and use it in GitHub Desktop.
Add an extra <h2> title before mini cart on woo product table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Author: Ibrahim Khalil | |
* Desc: Add an extra <h2> title before mini cart on woo product table | |
* Date: 23.07.2023 | |
*/ | |
function codeastrology_product_table_mini_cart_title_include() | |
{ | |
?> | |
<!-- Include jQuery library --> | |
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> | |
<!-- Your existing content with the element having class="widget_shopping_cart_content" --> | |
<div class="widget_shopping_cart_content"> | |
<!-- Content of the widget_shopping_cart_content --> | |
</div> | |
<!-- Add the <h2> title dynamically using jQuery --> | |
<script> | |
$(document).ready(function() { | |
// Create the <h2> element | |
var h2Element = $('<h2>').text('Your Title Goes Here'); | |
// Insert the <h2> element before the element with class="widget_shopping_cart_content" | |
$('.widget_shopping_cart_content').before(h2Element); | |
}); | |
</script> | |
<?php | |
} | |
add_action('wp_footer', 'codeastrology_product_table_mini_cart_title_include'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment