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 dw_product_totals() { | |
global $wpdb; | |
$post = get_post( $post_id ); | |
$current_product = get_the_ID($post); | |
$order_items = apply_filters( 'woocommerce_reports_top_earners_order_items', $wpdb->get_results( " |
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 | |
global $post; | |
$args = array( | |
'post_type' => 'page', //write slug of post type | |
'posts_per_page' => -1, | |
'post_parent' => $post->ID, //place here id of your parent page | |
'order' => 'ASC', | |
'orderby' => 'menu_order', | |
); | |
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
<div id='long'></div> | |
<div id='long'></div> | |
<pre id="response"></pre> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> | |
<script> | |
$.get("https://api.ipdata.co/?api-key=test", function (response) { | |
$("#response").html(JSON.stringify(response, null, 4)); | |
$("#long").html(response.latitude + ", " + response.longitude); | |
$("#long").html(response.city + ", " + response.longitude); |
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('wp_footer', 'ajax_product_fetch'); | |
function ajax_product_fetch() | |
{ | |
?> | |
<script type="text/javascript"> | |
function product_fetch() { | |
jQuery.ajax({ | |
url: '<?php echo admin_url('admin-ajax.php'); ?>', | |
type: 'post', | |
data: {action: 'product_fetch', product_keyword: jQuery('#product_keyword').val()}, |
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 | |
global $post; | |
function get_all_subpages($page, $args = '', $output = OBJECT) { | |
// Validate 'page' parameter | |
if (! is_numeric($page)) | |
$page = 0; | |
// Set up args | |
$default_args = array( | |
'post_type' => '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 | |
add_action( 'restrict_manage_posts', 'filter_backend_by_taxonomies' , 99, 2); | |
/* Filter CPT via Custom Taxonomy */ | |
/* https://generatewp.com/filtering-posts-by-taxonomies-in-the-dashboard/ */ | |
function filter_backend_by_taxonomies( $post_type, $which ) { | |
// Apply this to a specific CPT | |
if ( 'team' !== $post_type ) | |
return; |
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
<div class="wrapper-dropdown"> | |
<form class="woocommerce-ordering" method="get"> | |
<select name="orderby" class="orderby filter_orderby" aria-label="Shop order"> | |
<?php | |
$catalog_orderby = apply_filters( 'woocommerce_catalog_orderby', array( | |
'menu_order' => __( 'Default sorting', 'woocommerce' ), | |
'popularity' => __( 'Sort by popularity', 'woocommerce' ), | |
'rating' => __( 'Sort by average rating', 'woocommerce' ), |
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 | |
$get_yt_url = 'https://www.youtube.com/watch?v=VaSstf9VJGQ'; | |
preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $get_yt_url, $match); | |
$youtube_id = $match[1]; | |
echo "<img src='https://img.youtube.com/vi/$youtube_id/maxresdefault.jpg' alt='$getTitle'>"; | |
//Get youtube video title dynamically | |
echo explode(' - YouTube',explode('</title>',explode('<title>',file_get_contents("https://www.youtube.com/watch?v=$youtube_id"))[1])[0])[0]; |
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
//Providing the Gold pack download link on the order receive page. | |
add_filter('woocommerce_thankyou_order_received_text', 'woo_change_order_received_text', 10, 2 ); | |
function woo_change_order_received_text( $str, $order_id ) { | |
$order = wc_get_order( $order_id ); | |
$items = $order->get_items(); | |
foreach ( $items as $item_id => $item ) { | |
$product_id = $item->get_variation_id() ? $item->get_variation_id() : $item->get_product_id(); | |
if ( $product_id === 8936 ) { | |
if( $order->get_status() == 'processing' || $order->get_status() == 'completed' ) { | |
echo '<h3 style="background: #70C0AD;font-size: 24px;padding: 20px;margin-bottom: 30px; color: #fff;">You have successfully purchased <a href="#" target="_bkank" style="Color: #000; font-weight: bold;">Kidney Solution Gold Pack</a>. Please download the package from <a href="#" target="_bkank" style="Color: #000; font-weight: bold;">HERE</a>.</h3>'; |
OlderNewer