Force future event permalinks

This commit is contained in:
Brian Miyaji
2015-04-25 18:37:27 +10:00
parent 4d69291060
commit 6b06aa0995
5 changed files with 19 additions and 19 deletions

View File

@@ -51,7 +51,7 @@ class SP_WPML {
return $title; return $title;
} }
public static function post_type_link( $url, $post = null, $leavename = false ) { public static function post_type_link( $url, $post = null, $leavename = false, $sample = false ) {
if ( self::can_localize( $post ) ): if ( self::can_localize( $post ) ):
if ( ! $post ) global $post; if ( ! $post ) global $post;
@@ -62,7 +62,7 @@ class SP_WPML {
$translated_id = icl_object_id( $id, 'any', false, ICL_LANGUAGE_CODE ); $translated_id = icl_object_id( $id, 'any', false, ICL_LANGUAGE_CODE );
if ( $translated_id && $translated_id != $id && get_the_ID() != $translated_id ): if ( $translated_id && $translated_id != $id && get_the_ID() != $translated_id ):
return get_permalink( $translated_id, $leavename ); return get_post_permalink( $translated_id, $leavename, $sample );
endif; endif;
endif; endif;
@@ -88,7 +88,7 @@ class SP_WPML {
// Get URL // Get URL
$translated_id = icl_object_id( $id, 'any', false, $code ); $translated_id = icl_object_id( $id, 'any', false, $code );
if ( ! $translated_id ) continue; if ( ! $translated_id ) continue;
$url = get_permalink( $translated_id ); $url = get_post_permalink( $translated_id, false, true );
// Get native name; // Get native name;
$native_name = sp_array_value( $v, 'native_name' ); $native_name = sp_array_value( $v, 'native_name' );

View File

@@ -32,7 +32,7 @@ extract( $defaults, EXTR_SKIP );
if ( ! isset( $post ) ) return; if ( ! isset( $post ) ) return;
$title = $post->post_title; $title = $post->post_title;
if ( $link_events ) $title = '<a href="' . get_permalink( $post->ID ) . '">' . $title . '</a>'; if ( $link_events ) $title = '<a href="' . get_post_permalink( $post->ID, false, true ) . '">' . $title . '</a>';
?> ?>
<div class="sp-template sp-template-countdown"> <div class="sp-template sp-template-countdown">
<div class="sp-countdown-wrapper"> <div class="sp-countdown-wrapper">

View File

@@ -79,7 +79,7 @@ if ( $show_title && $id ) {
$j++; $j++;
if ( has_post_thumbnail ( $team ) ): if ( has_post_thumbnail ( $team ) ):
if ( $link_teams ): if ( $link_teams ):
$logo = '<a class="team-logo logo-' . ( $j % 2 ? 'odd' : 'even' ) . '" href="' . get_post_permalink( $team ) . '" title="' . get_the_title( $team ) . '">' . get_the_post_thumbnail( $team, 'sportspress-fit-icon' ) . '</a>'; $logo = '<a class="team-logo logo-' . ( $j % 2 ? 'odd' : 'even' ) . '" href="' . get_post_permalink( $team, false, true ) . '" title="' . get_the_title( $team ) . '">' . get_the_post_thumbnail( $team, 'sportspress-fit-icon' ) . '</a>';
else: else:
$logo = get_the_post_thumbnail( $team, 'sportspress-fit-icon', array( 'class' => 'team-logo logo-' . ( $j % 2 ? 'odd' : 'even' ) ) ); $logo = get_the_post_thumbnail( $team, 'sportspress-fit-icon', array( 'class' => 'team-logo logo-' . ( $j % 2 ? 'odd' : 'even' ) ) );
endif; endif;
@@ -122,7 +122,7 @@ if ( $show_title && $id ) {
<?php endif; endif; ?> <?php endif; endif; ?>
<h4 class="sp-event-title"> <h4 class="sp-event-title">
<?php if ( $link_events ): ?> <?php if ( $link_events ): ?>
<a href="<?php echo get_post_permalink( $event ); ?>"><?php echo $event->post_title; ?></a> <a href="<?php echo get_post_permalink( $event, false, true ); ?>"><?php echo $event->post_title; ?></a>
<?php else: ?> <?php else: ?>
<?php echo $event->post_title; ?> <?php echo $event->post_title; ?>
<?php endif; ?> <?php endif; ?>

View File

@@ -201,7 +201,7 @@ for ( $day = 1; $day <= $daysinmonth; ++$day ) {
$calendar_output .= '<td>'; $calendar_output .= '<td>';
if ( array_key_exists($day, $daywithpost) ) // any posts today? if ( array_key_exists($day, $daywithpost) ) // any posts today?
$calendar_output .= '<a data-tooltip data-options="disable_for_touch:true" class="has-tip" href="' . ( sizeof( $daywithpost[ $day ] ) > 1 ? add_query_arg( array( 'post_type' => 'sp_event' ), get_day_link( $thisyear, $thismonth, $day ) ) . '" title="' . sprintf( '%s events', ( sizeof( $daywithpost[ $day ] ) ) ) : get_permalink( $daywithpost[ $day ][0] ) . '" title="' . esc_attr( $ak_titles_for_day[ $day ] ) ) . "\">$day</a>"; $calendar_output .= '<a data-tooltip data-options="disable_for_touch:true" class="has-tip" href="' . ( sizeof( $daywithpost[ $day ] ) > 1 ? add_query_arg( array( 'post_type' => 'sp_event' ), get_day_link( $thisyear, $thismonth, $day ) ) . '" title="' . sprintf( '%s events', ( sizeof( $daywithpost[ $day ] ) ) ) : get_post_permalink( $daywithpost[ $day ][0], false, true ) . '" title="' . esc_attr( $ak_titles_for_day[ $day ] ) ) . "\">$day</a>";
else else
$calendar_output .= $day; $calendar_output .= $day;
$calendar_output .= '</td>'; $calendar_output .= '</td>';

View File

@@ -4,7 +4,7 @@
* *
* @author ThemeBoy * @author ThemeBoy
* @package SportsPress/Templates * @package SportsPress/Templates
* @version 1.6.1 * @version 1.8.2
*/ */
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -184,7 +184,7 @@ if ( $show_title && $id ) {
$date_html = '<date>' . get_post_time( 'Y-m-d H:i:s', false, $event ) . '</date>' . get_post_time( get_option( 'date_format' ), false, $event, true ); $date_html = '<date>' . get_post_time( 'Y-m-d H:i:s', false, $event ) . '</date>' . get_post_time( get_option( 'date_format' ), false, $event, true );
if ( $link_events ) $date_html = '<a href="' . get_permalink( $event->ID ) . '">' . $date_html . '</a>'; if ( $link_events ) $date_html = '<a href="' . get_post_permalink( $event->ID, false, true ) . '">' . $date_html . '</a>';
echo '<td class="data-date">' . $date_html . '</td>'; echo '<td class="data-date">' . $date_html . '</td>';
@@ -196,7 +196,7 @@ if ( $show_title && $id ) {
if ( 'combined' == $time_format && sp_column_active( $usecolumns, 'time' ) ) { if ( 'combined' == $time_format && sp_column_active( $usecolumns, 'time' ) ) {
echo '<td class="data-time">'; echo '<td class="data-time">';
if ( $link_events ) echo '<a href="' . get_permalink( $event->ID ) . '">'; if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '">';
if ( ! empty( $main_results ) ): if ( ! empty( $main_results ) ):
echo implode( ' - ', $main_results ); echo implode( ' - ', $main_results );
else: else:
@@ -206,7 +206,7 @@ if ( $show_title && $id ) {
echo '</td>'; echo '</td>';
} elseif ( in_array( $time_format, array( 'separate', 'results' ) ) && sp_column_active( $usecolumns, 'results' ) ) { } elseif ( in_array( $time_format, array( 'separate', 'results' ) ) && sp_column_active( $usecolumns, 'results' ) ) {
echo '<td class="data-results">'; echo '<td class="data-results">';
if ( $link_events ) echo '<a href="' . get_permalink( $event->ID ) . '">'; if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '">';
if ( ! empty( $main_results ) ): if ( ! empty( $main_results ) ):
echo implode( ' - ', $main_results ); echo implode( ' - ', $main_results );
else: else:
@@ -221,7 +221,7 @@ if ( $show_title && $id ) {
if ( in_array( $time_format, array( 'separate', 'time' ) ) && sp_column_active( $usecolumns, 'time' ) ) { if ( in_array( $time_format, array( 'separate', 'time' ) ) && sp_column_active( $usecolumns, 'time' ) ) {
echo '<td class="data-time">'; echo '<td class="data-time">';
if ( $link_events ) echo '<a href="' . get_permalink( $event->ID ) . '">'; if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '">';
echo '<date>&nbsp;' . get_post_time( 'H:i:s', false, $event ) . '</date>' . sp_get_time( $event ); echo '<date>&nbsp;' . get_post_time( 'H:i:s', false, $event ) . '</date>' . sp_get_time( $event );
if ( $link_events ) echo '</a>'; if ( $link_events ) echo '</a>';
echo '</td>'; echo '</td>';
@@ -234,7 +234,7 @@ if ( $show_title && $id ) {
echo '<td class="data-event data-teams">' . $teams_output . '</td>'; echo '<td class="data-event data-teams">' . $teams_output . '</td>';
} else { } else {
$title_html = implode( ' ', $team_logos ) . ' ' . $event->post_title; $title_html = implode( ' ', $team_logos ) . ' ' . $event->post_title;
if ( $link_events ) $title_html = '<a href="' . get_permalink( $event->ID ) . '">' . $title_html . '</a>'; if ( $link_events ) $title_html = '<a href="' . get_post_permalink( $event->ID, false, true ) . '">' . $title_html . '</a>';
echo '<td class="data-event">' . $title_html . '</td>'; echo '<td class="data-event">' . $title_html . '</td>';
} }
} }
@@ -243,14 +243,14 @@ if ( $show_title && $id ) {
case 'separate': case 'separate':
if ( sp_column_active( $usecolumns, 'time' ) ) { if ( sp_column_active( $usecolumns, 'time' ) ) {
echo '<td class="data-time">'; echo '<td class="data-time">';
if ( $link_events ) echo '<a href="' . get_permalink( $event->ID ) . '">'; if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '">';
echo '<date>&nbsp;' . get_post_time( 'H:i:s', false, $event ) . '</date>' . sp_get_time( $event ); echo '<date>&nbsp;' . get_post_time( 'H:i:s', false, $event ) . '</date>' . sp_get_time( $event );
if ( $link_events ) echo '</a>'; if ( $link_events ) echo '</a>';
echo '</td>'; echo '</td>';
} }
if ( sp_column_active( $usecolumns, 'results' ) ) { if ( sp_column_active( $usecolumns, 'results' ) ) {
echo '<td class="data-results">'; echo '<td class="data-results">';
if ( $link_events ) echo '<a href="' . get_permalink( $event->ID ) . '">'; if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '">';
if ( ! empty( $main_results ) ): if ( ! empty( $main_results ) ):
echo implode( ' - ', $main_results ); echo implode( ' - ', $main_results );
else: else:
@@ -263,7 +263,7 @@ if ( $show_title && $id ) {
case 'time': case 'time':
if ( sp_column_active( $usecolumns, 'time' ) ) { if ( sp_column_active( $usecolumns, 'time' ) ) {
echo '<td class="data-time">'; echo '<td class="data-time">';
if ( $link_events ) echo '<a href="' . get_permalink( $event->ID ) . '">'; if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '">';
echo '<date>&nbsp;' . get_post_time( 'H:i:s', false, $event ) . '</date>' . sp_get_time( $event ); echo '<date>&nbsp;' . get_post_time( 'H:i:s', false, $event ) . '</date>' . sp_get_time( $event );
if ( $link_events ) echo '</a>'; if ( $link_events ) echo '</a>';
echo '</td>'; echo '</td>';
@@ -272,7 +272,7 @@ if ( $show_title && $id ) {
case 'results': case 'results':
if ( sp_column_active( $usecolumns, 'results' ) ) { if ( sp_column_active( $usecolumns, 'results' ) ) {
echo '<td class="data-results">'; echo '<td class="data-results">';
if ( $link_events ) echo '<a href="' . get_permalink( $event->ID ) . '">'; if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '">';
if ( ! empty( $main_results ) ): if ( ! empty( $main_results ) ):
echo implode( ' - ', $main_results ); echo implode( ' - ', $main_results );
else: else:
@@ -285,7 +285,7 @@ if ( $show_title && $id ) {
default: default:
if ( sp_column_active( $usecolumns, 'time' ) ) { if ( sp_column_active( $usecolumns, 'time' ) ) {
echo '<td class="data-time">'; echo '<td class="data-time">';
if ( $link_events ) echo '<a href="' . get_permalink( $event->ID ) . '">'; if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '">';
if ( ! empty( $main_results ) ): if ( ! empty( $main_results ) ):
echo implode( ' - ', $main_results ); echo implode( ' - ', $main_results );
else: else:
@@ -330,7 +330,7 @@ if ( $show_title && $id ) {
if ( sp_column_active( $usecolumns, 'article' ) ): if ( sp_column_active( $usecolumns, 'article' ) ):
echo '<td class="data-article">'; echo '<td class="data-article">';
if ( $link_events ) echo '<a href="' . get_permalink( $event->ID ) . '">'; if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '">';
if ( $video ): if ( $video ):
echo '<div class="dashicons dashicons-video-alt"></div>'; echo '<div class="dashicons dashicons-video-alt"></div>';