// http://stackoverflow.com/questions/26581467/creating-woocommerce-order-with-line-item-programatically
$address = array(
'first_name' => 'Fresher',
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 | |
/** | |
* Edit default Woocommerce product loop thumbnail template | |
* As there is no dedicated Woocommerce template (eg wp-content/plugins/woocommerce/templates/loop/price.php) | |
* because it's generated using filter, we must remove Woocommerce hook, and add our own "at the same place" | |
* to edit the product loop thumbnail template | |
* tested up to | |
* 14/07/2023 : | |
* Woocommerce 6.2.2 | |
* 12/10/2020 : |
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
$('.slick-slider').not('.slick-initialized').slick({ | |
infinite: false, | |
slidesToShow: 1, | |
slidesToScroll: 1, | |
dots: true, | |
arrows: false, | |
touchThreshold: 9 | |
}); |
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_action( 'pre_get_posts' ,'dnshulga_exclude_pages' ); | |
function dnshulga_exclude_pages( $query ) { | |
if( !is_admin() ) | |
return $query; | |
global $pagenow; | |
if( 'edit.php' == $pagenow && ( get_query_var('post_type') && 'page' == get_query_var('post_type') ) ) | |
$query->set( 'post__not_in', array(213, 221) ); //ids of pages to hide | |
return $query; |
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 | |
/*Hide ACF Tottally*/ | |
add_filter('acf/settings/show_admin', '__return_false'); | |
function pands_admin_colors() { | |
echo '<style type="text/css"> | |
h2.hndle.ui-sortable-handle a.acf-hndle-cog { display: none; visibility: hidden } | |
</style>'; | |
} | |
add_action('acf/input/admin_head', 'pands_admin_colors'); | |
function disallowed_acf_page() { |
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 | |
function get_page_url($template_name) | |
{ | |
$pages = get_posts([ | |
'post_type' => 'page', | |
'post_status' => 'publish', | |
'meta_query' => [ | |
[ | |
'key' => '_wp_page_template', | |
'value' => $template_name.'.php', |
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 | |
function get_youtube_video_ID($youtube_video_url) { | |
/** | |
* Pattern matches | |
* http://youtu.be/ID | |
* http://www.youtube.com/embed/ID | |
* http://www.youtube.com/watch?v=ID | |
* http://www.youtube.com/?v=ID | |
* http://www.youtube.com/v/ID | |
* http://www.youtube.com/e/ID |
I have made this function using the WP_Image_Editor class and I have filtered through the "wp_generate_attachment_metadata" hook. You can modify the "theme" namespace into function names with your theme name or in anyway you like.
Applying the filter directly to wp_generate_attachment_metadata the image placeholders are auto added into WordPress metadata, so when your add/modify/delete an image (or regenerate it via a plugin), it accomplishes to modify also to the image placeholders.
The use of the native theme support can prevent the generation of lqip or target specific image sizes to generate.
It contains an hook filter lqip_quality to modify the quality without have to modify the function.
NewerOlder