Created
June 12, 2018 17:43
-
-
Save mdailey77/663e21ddde5285992dc791c580ff2776 to your computer and use it in GitHub Desktop.
Custom WordPress page template for listing webinar events in conjunction with Events Calendar API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Template Name: Custom Webinar Overview Page | |
* | |
* @package WordPress | |
*/ | |
// create an instance of getWebinars class from functions.php | |
$getwebinars = new getWebinars(); | |
// removes 'read more' link from excerpt | |
add_filter( 'the_excerpt', 'custom_remove_read_more' ); | |
get_header(); | |
?> | |
<div id="post-type-header"> | |
<div class="extended-content-container"> | |
<div class="extended-content"> | |
<?php // Get our post type header | |
echo custom_post_type_header( 'Webinars', 'event_overview', 'events', 'taxonomy-menu', false ); | |
?> | |
</div> | |
</div> | |
<?php wds_custom_breadcrumbs(); ?> | |
</div> | |
<div id="primary" class="site-content"> | |
<div class="inner"> | |
<div id="content" role="main"> | |
<div class="featured-webinars"> | |
<h2>Featured Webinars</h2> | |
<div id="featured-webinar"> | |
<?php $getwebinars->get_featured_webinars();?> | |
</div> | |
</div> | |
<div id="webinars-lower"> | |
<div id="archive-sidebar"> | |
<h3>Webinar Categories</h3> | |
<div class="menu-mobile"> | |
<a id="menu-toggle" href="#!"><span class="icon-navicon"></span></a> | |
</div> | |
<ul class="webinar-categories"> | |
<li><a href="<?php echo get_site_url() . '/events/category/webinar/';?>">All Webinars</a></li> | |
<?php | |
$cat = array( | |
"Enterprise" => "enterprise", | |
"Government" => "government", | |
"Higher Education" => "higher-education", | |
"Healthcare" => "healthcare", | |
"K-12" => "k-12", | |
"Sports and Entertainment" => "sports-and-entertainment" | |
); | |
foreach ($cat as $k => $v) { | |
echo '<li><a href="' . get_site_url() . '/events/category/' . $v . '/">' . $k . '</a></li>'; | |
}; | |
?> | |
</ul> | |
</div> | |
<div id="upcoming-webinars"> | |
<h2 class="archive-header">Upcoming Webinars</h2> | |
<?php $getwebinars->get_upcoming_webinars(4); ?> | |
</div> | |
<div id="ondemand-webinars"> | |
<h2 class="archive-header">On-Demand Webinars</h2> | |
<?php $getwebinars->get_ondemand_webinars(4); ?> | |
</div> | |
</div> | |
</div><!-- #content --> | |
</div><!-- .inner --> | |
</div><!-- #primary --> | |
<script> | |
(function ($) { | |
//check if the browser width is less 600px | |
if ($(window).width() <= 600) { | |
$('#menu-toggle').click(function() { | |
$('.webinar-categories').slideToggle(); | |
}); | |
} | |
})(jQuery); | |
</script> | |
<?php get_footer(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment