Skip to content

Instantly share code, notes, and snippets.

@xlawok
xlawok / PODS repeater - get in reapeater loop relationship field ID
Last active June 9, 2020 15:06
Wordpress PODS repeater and realationship - how to get in reapeater loop relationship field ID
$top_banner_items=pods_field( 'front_page_banner ', get_the_ID());
foreach($top_banner_items as $item):
$query = "SELECT related_item_id FROM {$wpdb->prefix}podsrel where item_id={$item['id']} and field_id=153";
$img_srcset = wp_get_attachment_image_srcset( $item['zdjcie'],'large');
echo '<a href="'.get_category_link($wpdb->get_var($query)).'" title="'.get_the_title().'" class="product-image">';
echo "<img class=''
sizes='(max-width: 991px) 100vw, 40vw'
function matterhorn_insert_product($product_data){
$post_id = wp_insert_post( array(
'post_author' => 1,
'post_title' => $product_data['mh_name'],
'post_content' => $product_data['mh_desc'],
'post_status' => 'publish',
'post_type' => "product",
) );
wp_set_object_terms( $post_id, 'variable', 'product_type' );
function woocommerce_detect_coupon_code() {
// Check if custom URI with coupon URL is requested
if(!empty($_GET['code'])) {
// Check if cart/shop page is set & redirect to it
// $shop_page_id = wc_get_page_id('shop');
// $cart_page_id = wc_get_page_id('cart');
if(!empty($cart_page_id) && WC()->cart->get_cart_contents_count() > 0) {
// $redirect_page = $cart_page_id;