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
/* Simple spam protection for email addresses using jQuery. | |
* Well, the protection isn’t jQuery-based, but you get the idea. | |
* This snippet allows you to slightly ‘obfuscate’ email addresses to make it harder for spambots to harvest them, while still offering a readable address to your visitors. | |
* E.g. | |
* <a href="mailto:foo(at)example(dot)com">foo at example dot com</a> | |
* → | |
* <a href="mailto:foo@example.com">foo@example.com</a> | |
*/ | |
$(function() { |
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 | |
//Order a query by ACF date picker | |
$event = get_posts(array( | |
'post_type' => 'events', | |
'posts_per_page' => 4, | |
'meta_key' => 'event_date', // name of custom field | |
'orderby' => 'meta_value_num', | |
'order' => 'ASC' | |
)); | |
if ($event) { |
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 | |
// To add custom data above add to cart button in woocommerce | |
// step 1 | |
add_action('wp_ajax_wdm_add_user_custom_data_options', 'wdm_add_user_custom_data_options_callback'); | |
add_action('wp_ajax_nopriv_wdm_add_user_custom_data_options', 'wdm_add_user_custom_data_options_callback'); | |
function wdm_add_user_custom_data_options_callback() |
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
/* | |
* Add description to Featured image box | |
*/ | |
function new_post_thumbnail_meta_box() { | |
global $post; | |
$thumbnail_id = get_post_meta( $post->ID, '_thumbnail_id', true ); // grabing the thumbnail id of the post | |
echo _wp_post_thumbnail_html( $thumbnail_id ); // echoing the html markup for the thumbnail |
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 | |
/** | |
* Export Data to CSV file | |
* Could be used in WordPress plugin or theme | |
*/ | |
// A sample link to Download CSV, could be placed somewhere in plugin settings page | |
?> | |
<a href="<?php echo admin_url( 'admin.php?page=myplugin-settings-page' ) ?>&action=download_csv&_wpnonce=<?php echo wp_create_nonce( 'download_csv' )?>" class="page-title-action"><?php _e('Export to CSV','my-plugin-slug');?></a> |
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
jQuery( function( $ ) { | |
if( $( window ).width() > 750 ) { | |
autoHeight( '.__your_class' ); | |
} else { | |
$( '.__your_class' ).height( 'auto' ); | |
} | |
$( window ).resize( function() { | |
if( $( window ).width() > 750 ) { | |
autoHeight( '.__your_class' ); |
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
/** | |
* Add first and last button to the | |
* default pagination of wordpress | |
* | |
* Note: Don't forget to initialize your default | |
* query to limit your post in pre_get_post hook | |
* | |
* @var string $post_type name of your post type | |
* @var int $total_post number of total post to get the number of pagination | |
* @return void pagination |
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
$( window ).scroll( function() { | |
if ( $(window).scrollTop() <= 50 ) { | |
$( 'header' ).removeClass( 'sticky' ); | |
} else { | |
$( 'header' ).addClass( 'sticky' ); | |
} | |
} ); |
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
easyweb-italia | |
4764fbb159e067e22458285444e844c313f26d6d |
OlderNewer