Exemple #1
0
 public static function alter_query($query, $left_clamp = null, $right_clamp = null, $limit = -1, $offset = 0)
 {
     if (empty($left_clamp)) {
         $left_clamp = self::$left_clamp;
     }
     if (empty($right_clamp)) {
         $right_clamp = self::$right_clamp;
     }
     self::$hero_slug = $query->get('event', null);
     if (empty(self::$hero_slug)) {
         self::$hero_slug = $query->get('name', null);
     }
     if (empty(self::$hero_slug)) {
         self::$hero_slug = $query->get('attachment', null);
     }
     /*?><pre style="margin-top: 100px;"><?php var_dump( $query->query_vars ); ?></pre><?php*/
     $query->set('post_type', self::$slug);
     $query->set('name', '');
     $query->set('event', '');
     $query->set('attachment', '');
     $query->set('order', 'ASC');
     $query->set('orderby', 'meta_value');
     $query->set('meta_key', self::$startdate_key);
     $query->set('meta_type', 'DATE');
     //$query->set( 'posts_per_page', $limit );
     //$query->set( 'offset', $offset );
     $dates = array(date('Y-m-d', self::$left_clamp), date('Y-m-d', self::$right_clamp));
     $query->set('meta_query', array('relation' => 'OR', array('key' => self::$enddate_key, 'value' => $dates, 'compare' => 'BETWEEN', 'type' => 'DATE'), array('key' => self::$startdate_key, 'value' => $dates, 'compare' => 'BETWEEN', 'type' => 'DATE')));
 }
?>
; padding: 10px;">
		<th style="padding: 0 0.9em;">
			<h3 style="color: white; text-transform: uppercase; margin: 0;"><?php 
the_title();
?>
</h3>
		</th>
	</tr>
	<tr style="background: #EFEFEF;">
		<td style="text-align: right; padding: 2px 1em; text-transform: uppercase; font-size: 80%; font-weight: bold;">
			<?php 
echo date("M j", Karma_Events::get_startdate());
?>
 - <?php 
echo date("M j, Y", Karma_Events::get_enddate());
?>
		</td>
	</tr>
	<tr style="background: #EFEFEF;">
		<td style="padding: 1em; padding-top: 0;">
			<?php 
the_excerpt();
?>
			<a href="<?php 
the_permalink();
?>
" style="font-size: 90%;">Read more online</a>
			<b style="font-size: 80%;"> OR </b>
			<a href="<?php 
the_permalink();
Exemple #3
0
		</div><!-- .site-branding -->

		<!--nav id="site-navigation" class="main-navigation" role="navigation">
			<button class="menu-toggle" aria-controls="primary-menu" aria-expanded="false"><?php 
esc_html_e('Primary Menu', 'karma');
?>
</button>
			<?php 
wp_nav_menu(array('theme_location' => 'primary', 'menu_id' => 'primary-menu'));
?>
		</nav><!-- #site-navigation -->

		<nav id="timeline">
			<div class="header">
				<?php 
Karma_Events::render_months();
?>
			</div>
			<div class="body">
				<?php 
global $wp_query;
while (have_posts()) {
    the_post();
    get_template_part('template-parts/content-event-strip');
}
rewind_posts();
?>
			</div>
			<div class="clear"></div>
		</nav>
		<div class="clear"></div>
Exemple #4
0
}
?>
		</div>
		<h4 class="title"><?php 
the_title();
?>
</h4>
	</header>
	<div class="content"><?php 
the_content();
?>
</div>
	<footer>
		<ul class="links">
			<?php 
$links = Karma_Events::get_contacts();
if (!empty($links)) {
    foreach ($links as $name => $link) {
        ?>
					<li><a href="<?php 
        echo $link['link'];
        ?>
"><?php 
        echo $link['name'];
        ?>
</a></li>
					<?php 
    }
}
?>
		</ul>
Exemple #5
0
function karma_alter_query($query)
{
    global $wp_query;
    if (!$query->is_main_query() || is_admin()) {
        return;
    }
    if (is_front_page() || $query->get('post_type') == Karma_Events::$slug) {
        Karma_Events::alter_query($query);
    }
}
Exemple #6
0
for ($i = 0; $i < count($data); $i++) {
    $data[$i]['startdate'] = strtotime($data[$i]['startdate']);
    $data[$i]['enddate'] = strtotime($data[$i]['enddate']);
    $event = $data[$i];
    Karma_Events_Display::register($data[$i]);
}
while (have_posts()) {
    the_post();
    $links = array();
    $contacts = Karma_Events::get_contacts();
    if (!empty($contacts)) {
        foreach ($contacts as $index => $contact) {
            $links[$contact['name']] = $contact['link'];
        }
    }
    Karma_Events_Display::register(array('startdate' => Karma_Events::get_startdate(), 'enddate' => Karma_Events::get_enddate(), 'title' => get_the_title(), 'content' => get_the_content(), 'links' => $links));
}
/*
Karma_Events::register( array(
	'startdate' => strtotime( "2015/08/10" ),
	'enddate' => strtotime( "2015/08/12" ),
	'title' => "London Yuva Seminar",
	'content' => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras tincidunt lorem quam, id bibendum eros feugiat id. Curabitur tortor orci, iaculis id massa vel, tempus eleifend elit. Donec euismod elit at est gravida, in congue metus facilisis.",
	'links' => array(
		"Website" => "http://www.realizecanada.ca"
	),
) );

Karma_Events::register( array(
	'startdate' => strtotime( "2015/08/17" ),
	'enddate' => strtotime( "2015/08/24" ),
<?php

global $post;
$startdate = Karma_Events::get_startdate();
$enddate = Karma_Events::get_enddate();
$startday = floor(abs(Karma_Events::$left_clamp - $startdate) / 86400);
$endday = floor(abs($enddate - Karma_Events::$left_clamp) / 86400);
if (!isset($strip_row_tracker)) {
    $strip_row_tracker = array();
}
$row = 0;
while (isset($strip[$row]) && $strip_row_tracker[$row] > $startdate) {
    $row++;
}
$strip_row_tracker[$row] = $enddate;
$width = ($endday - $startday) / 365 * 100;
$position = $startday / 365 * 100;
$month = strtolower(date("M", $startdate));
?>
<a class="strip <?php 
echo $month;
?>
 open-action"
	style="top: <?php 
echo 10 * $row;
?>
px; left: <?php 
echo $position;
?>
%; min-width: <?php 
echo $width;