This file contains hidden or 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
/** | |
* Indents a flat JSON string to make it more human-readable. | |
* | |
* http://www.daveperrett.com/articles/2008/03/11/format-json-with-php/ | |
*/ | |
function json_indent($json) | |
{ | |
$result = ''; | |
$pos = 0; | |
$strLen = strlen($json); |
This file contains hidden or 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
add_action('admin_enqueue_scripts', 'ds_admin_theme_style'); | |
add_action('login_enqueue_scripts', 'ds_admin_theme_style'); | |
function ds_admin_theme_style() { | |
if (!current_user_can( 'manage_options' )) { | |
echo '<style>.update-nag, .updated, .error, .is-dismissible { display: none; }</style>'; | |
} | |
} |
This file contains hidden or 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 | |
//AJAX ADD TO CART BUTTON | |
$product_id = 143; | |
if( !my_custom_cart_contains( $product_id ) ) { | |
?> | |
<button class="my-custom-add-to-cart-button" data-product-id="<?php echo $product_id; ?>">add to cart</button> | |
<?php | |
} else { | |
?> |
This file contains hidden or 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
$(function() { | |
// Filter Ajax Load More | |
var alm_is_animating = false; | |
$('#alm-filter-nav li').eq(0).addClass('active'); // Set the initial button active state | |
// Nav btn click event | |
$('#alm-filter-nav li a').on('click', function(e){ | |
e.preventDefault(); | |
var el = $(this); // Our selected element |
This file contains hidden or 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
#!/usr/bin/env python | |
''' | |
MySQL CRUD (Create Retrieve Update Delete) Operations using Python | |
''' | |
__author__ = "Alessandro Cucci" | |
__license__ = "MIT" | |
__version__ = "0.0.1" | |
__email__ = "[email protected]" | |
__status__ = "Development" |