dynamic_sidebar('bp_group_sidebar'); //groups } elseif (bp_current_component('members') && is_active_sidebar('bp_member_sidebar')) { dynamic_sidebar('bp_member_sidebar'); //members } elseif (is_active_sidebar('bp_sidebar')) { dynamic_sidebar('bp_sidebar'); } else { dynamic_sidebar('main_sidebar'); } } elseif (is_active_sidebar('bp_sidebar')) { dynamic_sidebar('bp_sidebar'); } else { dynamic_sidebar('main_sidebar'); } } elseif (is_single() && tm_is_post_video() && is_active_sidebar('single_video_sidebar')) { dynamic_sidebar('single_video_sidebar'); } elseif (is_single() && is_active_sidebar('single_blog_sidebar')) { dynamic_sidebar('single_blog_sidebar'); } elseif (is_page() && is_active_sidebar('single_page_sidebar') && !is_front_page()) { dynamic_sidebar('single_page_sidebar'); } elseif (function_exists('is_woocommerce') && is_woocommerce() && !is_shop()) { dynamic_sidebar('single_woo_sidebar'); } elseif (function_exists('is_shop') && is_shop()) { dynamic_sidebar('shop_sidebar'); } elseif (is_active_sidebar('main_sidebar')) { dynamic_sidebar('main_sidebar'); } } ?> </div><!--#sidebar-->
$likes = $graphObject->getProperty('share')->getProperty('share_count'); $wpdb->query($wpdb->prepare('DELETE FROM wp_wti_like_post where post_id=%d', $post->ID)); $data = array('post_id' => $post->ID, 'value' => $likes, 'date_time' => date('Y-m-d', time()), 'ip' => '', 'user_id' => 0); $wpdb->insert("{$wpdb->prefix}wti_like_post", $data); echo $post->ID . ' => ' . $link . ' tiene ' . $likes . ' likes<br/>'; $index++; } } $con1 = $index; wp_reset_query(); $arg = array('posts_per_page' => '-1', 'post_type' => 'post', 'cat' => '3,4,5,6,177'); $wp_query = new WP_Query($arg); $index = 0; while ($wp_query->have_posts()) { $wp_query->the_post(); if (tm_is_post_video()) { $link = get_permalink(); $request = new FacebookRequest($session, 'GET', '?id=' . $link . '?fields=likes&version=v2.1'); $response = $request->execute(); $graphObject = $response->getGraphObject(); $likes = $graphObject->getProperty('share')->getProperty('share_count'); $wpdb->query($wpdb->prepare('DELETE FROM wp_wti_like_post where post_id=%d', $post->ID)); $data = array('post_id' => $post->ID, 'value' => $likes, 'date_time' => date('Y-m-d', time()), 'ip' => '', 'user_id' => 0); $wpdb->insert("{$wpdb->prefix}wti_like_post", $data); echo $post->ID . ' => ' . $link . ' tiene ' . $likes . ' likes<br/>'; $index++; } } $con2 = $con1 + $index; echo 'Total ' . $con2 . ' Videos'; wp_reset_query();