Skip to content

Instantly share code, notes, and snippets.

@JEverhart383
Created May 16, 2019 00:02
Show Gist options
  • Save JEverhart383/555d371987694e64f28b9bd87bf52a99 to your computer and use it in GitHub Desktop.
Save JEverhart383/555d371987694e64f28b9bd87bf52a99 to your computer and use it in GitHub Desktop.
<?php
/*
Template Name: Homepage
@name Homepage Template
@since 2.0.0
@author Pavel Richter <[email protected]>
@copyright Copyright (c) 2014, Grand Pixels
*/
get_header();
?>
<div class="canvas-home clearfix">
<?php if (get_posts('post_type=slide')) { ?>
<div class="slideshow">
<div class="slideshow-container royalSlider gp-theme">
<?php
global $post;
// Counter
$slide_count = 1;
// Query
$gp_query_args = array(
'post_type' => 'slide',
'posts_per_page' => -1
);
query_posts($gp_query_args);
// Loop
if (have_posts()) {
while (have_posts()) {
the_post();
$slide_image_helper = get_template_directory_uri() . '/images/bg-helper-00050a.png';
$slide_title = __(gp_meta('gp_slide_title'));
$slide_caption = __(gp_meta('gp_slide_caption'));
$slide_url = __(gp_meta('gp_slide_url'));
$slide_youtube_code = gp_get_youtube_video_id(__(gp_meta('gp_slide_youtube_code')));
$slide_vimeo_code = gp_get_vimeo_video_id(__(gp_meta('gp_slide_vimeo_code')));
$slide_image_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
if (!empty($slide_youtube_code)) {
?>
<div class="slide-<?php echo $slide_count; ?> rsContent">
<a class="rsImg" data-rsVideo="http://www.youtube.com/watch?v=<?php echo $slide_youtube_code; ?>" href="<?php if (has_post_thumbnail()) { echo $slide_image_url[0]; } else { echo $slide_image_helper; } ?>"></a>
<div class="slide-caption rsABlock" data-fade-effect="true" data-move-effect="bottom" data-move-offset="100" data-speed="300" data-delay="0" data-easing="easeOutSine">
<?php
if ($slide_title != '0') {
if (!empty($slide_url)) {
?>
<h2 class="link rsNoDrag">
<a href="<?php echo $slide_url; ?>" title="<?php the_title_attribute(); ?>">
<?php the_title(); ?>
</a>
</h2>
<?php
} else {
?>
<h2>
<?php the_title(); ?>
</h2>
<?php
}
}
?>
<?php if (!empty($slide_caption)) { ?>
<p><?php echo $slide_caption; ?></p>
<?php } ?>
</div><!-- END // slide-caption -->
</div><!-- END // slide -->
<?php
} else if (!empty($slide_vimeo_code)) {
?>
<div class="slide-<?php echo $slide_count; ?> rsContent">
<a class="rsImg" data-rsVideo="https://vimeo.com/<?php echo $slide_vimeo_code; ?>" href="<?php if (has_post_thumbnail()) { echo $slide_image_url[0]; } else { echo $slide_image_helper; } ?>"></a>
<div class="slide-caption rsABlock" data-fade-effect="true" data-move-effect="bottom" data-move-offset="100" data-speed="300" data-delay="0" data-easing="easeOutSine">
<?php
if ($slide_title != '0') {
if (!empty($slide_url)) {
?>
<h2 class="link rsNoDrag">
<a href="<?php echo $slide_url; ?>" title="<?php the_title_attribute(); ?>">
<?php the_title(); ?>
</a>
</h2>
<?php
} else {
?>
<h2>
<?php the_title(); ?>
</h2>
<?php
}
}
?>
<?php if (!empty($slide_caption)) { ?>
<p><?php echo $slide_caption; ?></p>
<?php } ?>
</div><!-- END // slide-caption -->
</div><!-- END // slide -->
<?php
} else if (has_post_thumbnail()) {
?>
<div class="slide-<?php echo $slide_count; ?> rsContent">
<img class="rsImg" src="<?php echo $slide_image_url[0]; ?>" alt="<?php echo $slide_title; ?>" />
<div class="slide-caption rsABlock" data-fade-effect="true" data-move-effect="bottom" data-move-offset="100" data-speed="300" data-delay="0" data-easing="easeOutSine">
<?php
if ($slide_title != '0') {
if (!empty($slide_url)) {
?>
<h2 class="link rsNoDrag">
<a href="<?php echo $slide_url; ?>" title="<?php the_title_attribute(); ?>">
<?php the_title(); ?>
</a>
</h2>
<?php
} else {
?>
<h2>
<?php the_title(); ?>
</h2>
<?php
}
}
?>
<?php if (!empty($slide_caption)) { ?>
<p><?php echo $slide_caption; ?></p>
<?php } ?>
</div><!-- END // slide-caption -->
</div><!-- END // slide -->
<?php
} //if
$slide_count++;
} //while
} //if
wp_reset_query();
?>
</div><!-- END // slideshow -->
</div><!-- END // slideshow-container -->
<?php } ?>
<div class="canvas-block clearfix">
<div class="canvas-container clearfix">
<?php
if (get_posts('post_type=callout') && gp_option('gp_callout_homepage') != 'false') {
if (wp_count_posts('callout')->publish == 1) {
$callout_number = 1;
} else if (wp_count_posts('callout')->publish == 2) {
$callout_number = 2;
} else if (wp_count_posts('callout')->publish == 3) {
$callout_number = 3;
} else if (wp_count_posts('callout')->publish == 4) {
$callout_number = 4;
} else if (wp_count_posts('callout')->publish > 4) {
$callout_number = 4;
} else {
$callout_number = 4;
}
?>
<div class="grid-callout-home grid posts-no-<?php echo $callout_number; ?><?php if (!get_posts('post_type=slide')) { ?> no-slides<?php }?>">
<?php
global $post;
// Counter
$callout_count = 1;
// Query
$gp_query_args = array(
'post_type' => 'callout',
'posts_per_page' => $callout_number
);
query_posts($gp_query_args);
// Loop
if (have_posts()) {
while (have_posts()) {
the_post();
if (has_post_thumbnail()) {
$class_thumbnail = 'has-post-thumbnail';
} else {
$class_thumbnail = 'no-post-thumbnail';
}
if (gp_meta('gp_callout_url')) {
$class_url = 'has-url';
} else {
$class_url = 'no-url';
}
$callout_title = __(gp_meta('gp_callout_title'));
$callout_url = __(gp_meta('gp_callout_url'));
$callout_description = __(gp_meta('gp_callout_description'));
$callout_class = array('post', 'post-no-' . $callout_count, $class_thumbnail, $class_url);
?>
<article <?php post_class($callout_class); ?>>
<?php if ($callout_title != '0') { ?>
<h3 class="post-header transition corner-top">
<span class="post-title">
<?php
if (!empty($callout_url)) {
?>
<a class="corner-top" href="<?php echo $callout_url; ?>" title="<?php the_title_attribute(); ?>">
<?php the_title(); ?>
</a>
<?php
} else {
the_title();
}
?>
</span>
</h3><!-- END // post-header -->
<?php } ?>
<?php if (has_post_thumbnail()) { ?>
<div class="post-image overlay<?php if (empty($callout_description)) { ?> no-excerpt<?php } ?>">
<?php
if (!empty($callout_url)) {
?>
<a href="<?php echo $callout_url; ?>" title="<?php the_title_attribute(); ?>">
<?php the_post_thumbnail('small-fixed'); ?>
<span class="overlay-block"><span class="overlay-icon"></span></span>
</a>
<?php
} else {
the_post_thumbnail('small-fixed');
}
?>
</div><!-- END // post-image -->
<?php } ?>
<?php if ($callout_description) { ?>
<div class="post-content corner-bottom">
<?php echo do_shortcode($callout_description); ?>
</div><!-- END // post-excerpt -->
<?php } ?>
</article><!-- END // post -->
<?php
$callout_count++;
} // while
} // if
wp_reset_query();
?>
</div><!-- END // grid-callout-home -->
</div>
</div>
<div class="canvas-blue clearfix">
<div class="canvas-container clearfix">
<p align="center" class="canvas-blue-title">Events</p>
<?php echo do_shortcode('[carousel-horizontal-posts-content-slider]'); ?>
</div></div>
<div class="canvas-paper clearfix">
<div class="canvas-container clearfix">
<?php
} // if
?>
<?php
if (have_posts()) {
while (have_posts()) {
the_post();
if (!empty($post->post_content)) {
?>
<div class="page-content">
<?php the_content(); ?>
</div><!-- END // page-content -->
<?php
}
} //while
} //if
wp_reset_query();
?>
<?php
if (gp_option('gp_post_homepage') != 'false') {
if (wp_count_posts()->publish == 1) {
$post_number = 1;
} else if (wp_count_posts()->publish == 2) {
$post_number = 2;
} else if (wp_count_posts()->publish == 3) {
$post_number = 3;
} else if (wp_count_posts()->publish == 4) {
$post_number = 4;
} else if (wp_count_posts()->publish > 4) {
$post_number = 4;
} else {
$post_number = 4;
}
// Title
if (gp_option('gp_post_homepage_title')) {
$post_title = gp_option('gp_post_homepage_title');
} else {
$post_title = __('Recent posts', 'gp');
}
?>
<?php if (gp_option('gp_post_homepage_title_show') != 'false') { ?>
<h2 class="home-header align-center">
<?php echo $post_title; ?>
</h2>
<?php } ?>
<div class="grid-post-home grid posts-no-<?php echo $post_number; ?>">
<?php
global $post;
// Counter
$post_count = 1;
// View Type
$view_type = 'grid';
$view_page = 'home';
// Query
$gp_query_args = array(
'ignore_sticky_posts' => 1,
'posts_per_page' => $post_number,
'tax_query' => array(
array(
'taxonomy' => 'category',
'terms' => array('events'),
'field' => 'slug',
'operator' => 'NOT IN'
)
)
);
query_posts($gp_query_args);
// Loop
if (have_posts()) {
while (have_posts()) {
the_post();
// Post Format
if (!get_post_format()) {
$post_format = 'format-standard';
} else {
$post_format = 'format-' . get_post_format();
}
$post_class = array('post-no-' . $post_count, $post_format);
?>
<article id="post-<?php the_ID(); ?>" <?php post_class($post_class); ?>>
<?php
if (!get_post_format()) {
get_template_part('content', 'standard');
} else {
get_template_part('content', get_post_format());
}
?>
</article><!-- END // post -->
<?php
$post_count++;
} // while
} // if
wp_reset_query();
?>
</div><!-- END // grid-post-home -->
<?php
} // if
?>
</div>
</div>
</div><!-- END // canvas-container -->
</div><!-- END // canvas-home -->
<?php
get_footer();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment