Advertisement
BakerMan

Mark empty day links "nofollow" (TEC 3.0) in month view

Jul 16th, 2013
633
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.26 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Override for the month view single day template.
  4.  *
  5.  * This file should live at [your-theme]/tribe-events/month/single-day.php - it is one part of a workaround to avoid
  6.  * empty day views from being indexed by search engines (as those pages return a 404 status).
  7.  */
  8.  
  9. if ( !defined('ABSPATH') ) { die('-1'); } ?>
  10.  
  11. <?php $day = tribe_events_get_current_month_day() ?>
  12.  
  13. <?php if ($day['date'] != 'previous' && $day['date'] != 'next') : ?>
  14.  
  15.     <?php $has_events = false ?>
  16.     <?php ob_start() ?>
  17.  
  18.     <!-- Events List -->
  19.     <?php while ($day['events']->have_posts()) : $day['events']->the_post() ?>
  20.         <?php tribe_get_template_part('month/single', 'event') ?>
  21.         <?php $has_events = true ?>
  22.     <?php endwhile; ?>
  23.  
  24.     <!-- View More -->
  25.     <?php if ($day['view_more']) : ?>
  26.         <div class="tribe-events-viewmore">
  27.             <a href="<?php echo $day['view_more'] ?>">View All <?php echo $day['total_events'] ?> &raquo;</a>
  28.         </div>
  29.     <?php endif ?>
  30.  
  31.     <?php $day_items = ob_get_clean() ?>
  32.  
  33.     <!-- Day Header -->
  34.     <div id="tribe-events-daynum-<?php echo $day['daynum'] ?>">
  35.  
  36.         <a href="<?php echo tribe_get_day_link($day['date']) ?>" <?php if (!$has_events) echo 'rel="nofollow"' ?>><?php echo $day['daynum'] ?></a>
  37.  
  38.     </div>
  39.  
  40.     <?php echo $day_items ?>
  41.  
  42. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement