Ticket #921 -> Filtrar la página de inicio para no repetir dedicatorias con la misma URL de video
git-svn-id: https://192.168.0.254/svn/Proyectos.ASong2U_Web/trunk@32 cd1a4ea2-8c7f-e448-aada-19d1fee9e1d6
This commit is contained in:
parent
99715f6ade
commit
cef361b14a
@ -19,6 +19,10 @@ $dirname = "score"; // Directory Name
|
|||||||
if ( !defined( 'DEDICATION_CATEGORY_SLUG' ) )
|
if ( !defined( 'DEDICATION_CATEGORY_SLUG' ) )
|
||||||
define( 'DEDICATION_CATEGORY_SLUG', 'dedication' );
|
define( 'DEDICATION_CATEGORY_SLUG', 'dedication' );
|
||||||
|
|
||||||
|
/* * ************************* Concerts Information ********************* */
|
||||||
|
|
||||||
|
if ( !defined( 'CONCERTS_CATEGORY_SLUG' ) )
|
||||||
|
define( 'CONCERTS_CATEGORY_SLUG', 'concerts' );
|
||||||
|
|
||||||
/* * ************************* File Directories ************************** */
|
/* * ************************* File Directories ************************** */
|
||||||
|
|
||||||
@ -306,9 +310,9 @@ function register_my_menus() {
|
|||||||
|
|
||||||
/* * ************************* Dedication category ********************* */
|
/* * ************************* Dedication category ********************* */
|
||||||
|
|
||||||
add_action('init', 'register_dedication_category');
|
//add_action('init', 'register_dedication_category');
|
||||||
function register_dedication_category() {
|
function register_dedication_category() {
|
||||||
|
global $wpdb;
|
||||||
if (!get_category_by_slug(DEDICATION_CATEGORY_SLUG)) {
|
if (!get_category_by_slug(DEDICATION_CATEGORY_SLUG)) {
|
||||||
$cat = array(
|
$cat = array(
|
||||||
'cat_name' => 'Dedication',
|
'cat_name' => 'Dedication',
|
||||||
@ -318,6 +322,21 @@ function register_dedication_category() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* * ************************* Concerts category ********************* */
|
||||||
|
|
||||||
|
//add_action('init', 'register_concerts_category');
|
||||||
|
function register_concerts_category() {
|
||||||
|
global $wpdb;
|
||||||
|
if (!get_category_by_slug(CONCERTS_CATEGORY_SLUG)) {
|
||||||
|
$cat = array(
|
||||||
|
'cat_name' => 'Concerts',
|
||||||
|
'category_nicename' => CONCERTS_CATEGORY_SLUG);
|
||||||
|
|
||||||
|
wp_insert_category($cat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* * ************************* Other Features ************************** */
|
/* * ************************* Other Features ************************** */
|
||||||
|
|
||||||
|
|||||||
@ -54,7 +54,11 @@
|
|||||||
<!--End Nav-->
|
<!--End Nav-->
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<ul class="navmenu">
|
<ul class="navmenu">
|
||||||
<li><a class="events" href="#"><span><?php __( 'Events', 'buddypress' ); ?></span></a></li>
|
<?php
|
||||||
|
$category_id = get_cat_ID( 'concerts' );
|
||||||
|
$category_link = get_category_link( $category_id );
|
||||||
|
?>
|
||||||
|
<li><a class="events" title="<?php __( 'Concerts', 'buddypress' ); ?>" href="<?php echo esc_url( $category_link ); ?>"><span><?php __( 'Concerts', 'buddypress' ); ?></span></a></li>
|
||||||
<li><a title="<?php __( 'Members', 'buddypress' ); ?>" class="friends" href="<?php echo bp_get_members_directory_permalink(); ?>"><span><?php __( 'Members', 'buddypress' ); ?></span></a></li>
|
<li><a title="<?php __( 'Members', 'buddypress' ); ?>" class="friends" href="<?php echo bp_get_members_directory_permalink(); ?>"><span><?php __( 'Members', 'buddypress' ); ?></span></a></li>
|
||||||
<li><a title="<?php __( 'Groups', 'buddypress' ); ?>" class="groups " href="<?php echo bp_get_groups_directory_permalink(); ?>"><span><?php __( 'Groups', 'buddypress' ); ?></span></a></li>
|
<li><a title="<?php __( 'Groups', 'buddypress' ); ?>" class="groups " href="<?php echo bp_get_groups_directory_permalink(); ?>"><span><?php __( 'Groups', 'buddypress' ); ?></span></a></li>
|
||||||
<li><a class="profile" href="<?php if(function_exists('bp_is_active')) { echo $bp->loggedin_user->domain; } else { echo get_author_posts_url(get_the_author_id()); } ?>"><span><?php _e('Profile', 'gp_lang'); ?></span></a></li>
|
<li><a class="profile" href="<?php if(function_exists('bp_is_active')) { echo $bp->loggedin_user->domain; } else { echo get_author_posts_url(get_the_author_id()); } ?>"><span><?php _e('Profile', 'gp_lang'); ?></span></a></li>
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<?php get_header();
|
<?php get_header();
|
||||||
|
|
||||||
global $gp_settings;
|
global $gp_settings;
|
||||||
|
$_ishome = (is_home() OR is_front_page());
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@ -9,6 +10,7 @@ global $gp_settings;
|
|||||||
$args = "cat=".$gp_settings['cats']."&caller_get_posts=1&orderby=$orderby&order=$order&gdsr_sort=$gdsr_sort&gdsr_order=$gdsr_order&paged=$paged";
|
$args = "cat=".$gp_settings['cats']."&caller_get_posts=1&orderby=$orderby&order=$order&gdsr_sort=$gdsr_sort&gdsr_order=$gdsr_order&paged=$paged";
|
||||||
query_posts($args);
|
query_posts($args);
|
||||||
$contador = 0;
|
$contador = 0;
|
||||||
|
$urls_video = array();
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
@ -32,6 +34,18 @@ $contador = 0;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$contador += 1;
|
$contador += 1;
|
||||||
|
|
||||||
|
$video = get_post_meta($post->ID, 'ghostpool_dedication_url', true);
|
||||||
|
if ($_ishome) {
|
||||||
|
if ($theme_homepage_not_repeat_videos) {
|
||||||
|
// Si la URL del video ya ha salido en una dedicatoria anterior, me la salto
|
||||||
|
if (in_array($video, $urls_video)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$urls_video[] = $video;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -367,6 +367,13 @@ array("name" => __('Video Slider Settings', 'gp_lang'),
|
|||||||
"id" => $shortname . "_homepage_cats",
|
"id" => $shortname . "_homepage_cats",
|
||||||
"std" => get_category_by_slug(BP_DEDICATION_SLUG),
|
"std" => get_category_by_slug(BP_DEDICATION_SLUG),
|
||||||
"type" => "text"),
|
"type" => "text"),
|
||||||
|
array(
|
||||||
|
"name" => __('Repeat videos', 'gp_lang'),
|
||||||
|
"desc" => __('Repeat videos on dedications.', 'gp_lang'),
|
||||||
|
"id" => $shortname . "_homepage_not_repeat_videos",
|
||||||
|
"std" => "0",
|
||||||
|
"options" => array(__('Enable', 'gp_lang'), __('Disable', 'gp_lang')),
|
||||||
|
"type" => "radio"),
|
||||||
array("type" => "divider"),
|
array("type" => "divider"),
|
||||||
array(
|
array(
|
||||||
"name" => __('Layout', 'gp_lang'),
|
"name" => __('Layout', 'gp_lang'),
|
||||||
|
|||||||
@ -1,69 +1,3 @@
|
|||||||
<?php
|
<?php
|
||||||
// Custom Post Types
|
|
||||||
|
|
||||||
/*function post_type_dedication() {
|
|
||||||
|
|
||||||
register_post_type('dedication', array(
|
|
||||||
'labels' => array(
|
|
||||||
'name' => __('Dedications', 'gp_lang'),
|
|
||||||
'singular_name' => __('Dedication', 'gp_lang'),
|
|
||||||
'all_items' => __('All Dedications', 'gp_lang'),
|
|
||||||
'add_new_item' => __('Add New Dedication', 'gp_lang'),
|
|
||||||
'edit_item' => __('Edit Dedication', 'gp_lang'),
|
|
||||||
'new_item' => __('New Dedication', 'gp_lang'),
|
|
||||||
'view_item' => __('View Dedication', 'gp_lang'),
|
|
||||||
'search_items' => __('Search Dedications', 'gp_lang'),
|
|
||||||
'menu_name' => __('Dedications', 'gp_lang')
|
|
||||||
),
|
|
||||||
'public' => true,
|
|
||||||
'exclude_from_search' => false,
|
|
||||||
'show_ui' => true,
|
|
||||||
'show_in_nav_menus' => false,
|
|
||||||
'_builtin' => false,
|
|
||||||
'_edit_link' => 'post.php?post=%d',
|
|
||||||
'capability_type' => 'post',
|
|
||||||
'hierarchical' => false,
|
|
||||||
'rewrite' => array("slug" => "dedication"),
|
|
||||||
'menu_position' => 20,
|
|
||||||
'with_front' => true,
|
|
||||||
'supports' => array('title', 'thumbnail', 'author', 'custom-fields')
|
|
||||||
));
|
|
||||||
|
|
||||||
add_filter("manage_edit-dedication_columns", "dedication_edit_columns");
|
|
||||||
add_action("manage_posts_custom_column", "dedication_custom_columns");
|
|
||||||
|
|
||||||
function dedication_edit_columns($columns) {
|
|
||||||
$columns = array(
|
|
||||||
"cb" => "<input type=\"checkbox\" />",
|
|
||||||
"title" => __('Title', 'gp_lang'),
|
|
||||||
"author" => __('Author', 'gp_lang'),
|
|
||||||
"dedication_url" => __('Video URL', 'gp_lang'),
|
|
||||||
"dedication_image" => __('Image', 'gp_lang'),
|
|
||||||
"date" => __('Date', 'gp_lang')
|
|
||||||
);
|
|
||||||
|
|
||||||
return $columns;
|
|
||||||
}
|
|
||||||
|
|
||||||
function dedication_custom_columns($column) {
|
|
||||||
global $post;
|
|
||||||
require(ghostpool_inc . 'options.php');
|
|
||||||
switch ($column) {
|
|
||||||
case "dedication_url":
|
|
||||||
echo get_post_meta($post->ID, 'ghostpool_dedication_url', true);
|
|
||||||
break;
|
|
||||||
case "dedication_image":
|
|
||||||
if (has_post_thumbnail()) {
|
|
||||||
$image = vt_resize(get_post_thumbnail_id(), '', 50, 50, true);
|
|
||||||
echo '<img src="' . $image[url] . '" width="' . $image[width] . '" alt="" />';
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
add_action('init', 'post_type_dedication');*/
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@ -3,12 +3,18 @@
|
|||||||
|
|
||||||
require(ghostpool_inc . 'options.php');
|
require(ghostpool_inc . 'options.php');
|
||||||
|
|
||||||
|
$_ishome = (is_home() OR is_front_page());
|
||||||
|
|
||||||
if ( is_user_logged_in() ):
|
if ( is_user_logged_in() ):
|
||||||
|
|
||||||
|
global $gp_settings;
|
||||||
global $current_user, $bp;
|
global $current_user, $bp;
|
||||||
get_currentuserinfo();
|
get_currentuserinfo();
|
||||||
|
|
||||||
if (is_home() || is_front_page() || ( $bp->current_component == 'dedications' )) {
|
?>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
if ($_ishome || ( $bp->current_component == 'dedications' )) {
|
||||||
$posts_per_page = $theme_video_slides;
|
$posts_per_page = $theme_video_slides;
|
||||||
|
|
||||||
$dedication_orderby = "date";
|
$dedication_orderby = "date";
|
||||||
@ -33,6 +39,7 @@ if (is_singular()) {
|
|||||||
|
|
||||||
if (have_posts()) {
|
if (have_posts()) {
|
||||||
$slide_counter = 0;
|
$slide_counter = 0;
|
||||||
|
$urls_video = array();
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!--Begin Slider Wrapper-->
|
<!--Begin Slider Wrapper-->
|
||||||
@ -85,6 +92,16 @@ if (have_posts()) {
|
|||||||
$artist = get_post_meta($post->ID, 'ghostpool_dedication_artist', true);
|
$artist = get_post_meta($post->ID, 'ghostpool_dedication_artist', true);
|
||||||
$song = get_post_meta($post->ID, 'ghostpool_dedication_song', true);
|
$song = get_post_meta($post->ID, 'ghostpool_dedication_song', true);
|
||||||
|
|
||||||
|
if ($_ishome) {
|
||||||
|
if ($theme_homepage_not_repeat_videos) {
|
||||||
|
// Si la URL del video ya ha salido en una dedicatoria anterior, me la salto
|
||||||
|
if (in_array($video, $urls_video)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$urls_video[] = $video;
|
||||||
|
|
||||||
// Video Type
|
// Video Type
|
||||||
$vimeo = strpos($video, "vimeo.com");
|
$vimeo = strpos($video, "vimeo.com");
|
||||||
$yt1 = strpos($video, "youtube.com");
|
$yt1 = strpos($video, "youtube.com");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user