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
function cb_related_ajax() | |
{ | |
$sample_ajax = $_POST['hello']; | |
echo $sample_ajax; | |
wp_die(); | |
} |
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_filter('woocommerce_single_product_image_thumbnail_html', 'remove_featured_image', 10, 3); | |
//hides featured image progmatically | |
function remove_featured_image($html, $attachment_id, $post_id) { | |
$featured_image = get_post_thumbnail_id($post_id); | |
$filtered_products = array(271479); | |
if(in_array($post_id, $filtered_products)){ |
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
function find_hero_ability($ability){ | |
$args = array( | |
'role' => 'hero', | |
'meta_query' => array( | |
array( | |
'key' => 'ability', | |
'value' => $ability, | |
'compare' => 'LIKE' | |
) | |
) |
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
function woocommerce_custom_tax() { | |
global $woocommerce; | |
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) | |
return; | |
$flowers_in_cart = false; | |
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) { | |
//check if there's a product under flowers category |
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
function export_to_csv(){ | |
//will trigger when export_test isset as get variable | |
if(isset($_GET['export_test'])){ | |
$file_name = 'csv_file'."_".date("Y-m-d").'.csv'; | |
header('Content-Type: application/csv'); | |
header("Content-Disposition: attachment; filename=".$file_name.""); | |
header('Pragma: no-cache'); |
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
<script type="text/javascript"> | |
jQuery(document).ready(function ($) { | |
$(window).load(function() { | |
alert("I'm done loading!"); | |
}); | |
}); | |
</script> |
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
<script type="text/javascript"> | |
jQuery(document).ready(function ($) { | |
$(".btn_schedule").click(function() { | |
var selected_id = 1; | |
var schedule = {"Monday":{"morning":"8:00 am","afternoon":"1:00 pm"}, | |
"Tuesday":{"morning":"8:00 am","afternoon":"1:00 pm"}}; | |
var myJSON = JSON.stringify(schedule); | |
save_clinic_schedule(selected_id,myJSON); | |
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
// create custom plugin settings menu | |
add_action('admin_menu', 'rda_create_menu'); | |
function rda_create_menu() { | |
//create new top-level menu | |
add_menu_page('RDA Plugin Settings', 'RDA Settings', 'administrator', __FILE__, 'rda_settings_page' | |
,'dashicons-carrot'); | |
//call register settings 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 | |
function enqueu_this_scipt(){ | |
wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/example.js', array(), '1.0.0', true ); | |
$translation = array( | |
'greetings'=> 'Hellow world!' | |
); | |
wp_localize_script( 'script-name', 'my_handler', $translation ); |
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 enqueu_this_scipt(){ | |
global $post; | |
if ( is_a( $post, 'WP_Post' ) && has_shortcode( $post->post_content, 'awesome_shortcode') ) { | |
wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/example.js', array(), '1.0.0', true ); | |