-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalt_homepage_no_widget.php
132 lines (101 loc) · 6.34 KB
/
alt_homepage_no_widget.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?php
/**
* Template Name: Alt_HomePage, Slider and Content, No Widgets
* Description: An alternative homepage that displays the latest posts in the slider, no widgets and page title just the page content.
*/
get_header(); ?>
<div id="content" class="clearfix full-width-content">
<div id="main" class="clearfix sldr" role="main">
<div id="slide-wrap">
<?php
$args = array(
'posts_per_page' => 10,
'post_status' => 'publish',
);
$fPosts = new WP_Query( $args );
$countPosts = $fPosts->found_posts;
?>
<?php if ( $fPosts->have_posts() ) : ?>
<?php if ($countPosts > 1) : ?>
<div id="load-cycle"></div>
<div class="cycle-slideshow" <?php
if ( get_theme_mod('attorney_slider_effect') ) {
echo 'data-cycle-fx="' . wp_kses_post( get_theme_mod('attorney_slider_effect') ) . '" data-cycle-tile-count="10"';
} else {
echo 'data-cycle-fx="scrollHorz"';
}
?> data-cycle-slides="> div.slides" <?php
if ( get_theme_mod('attorney_slider_timeout') ) {
$slider_timeout = wp_kses_post( get_theme_mod('attorney_slider_timeout') );
echo 'data-cycle-timeout="' . $slider_timeout . '000"';
} else {
echo 'data-cycle-timeout="2500"';
}
?> data-cycle-pause-on-hover="true">
<?php /* Start the Loop */ ?>
<?php while ( $fPosts->have_posts() ) : $fPosts->the_post(); ?>
<div class="slides">
<div id="post-<?php the_ID(); ?>" <?php post_class('post-theme'); ?>>
<?php if ( has_post_thumbnail()) : ?>
<div class="slide-thumb" style="background-image:url(<?php $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array(1000, 640), false, '' ); echo $src[0]; ?>)"></div>
<?php else : ?>
<?php $postimgs =& get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC' ) );
if ( !empty($postimgs) ) :
$firstimg = array_shift( $postimgs );
$my_image = wp_get_attachment_url( $firstimg->ID, array( 1000, 640 ), false, '' );
?>
<div class="slide-thumb" style="background-image:url(<?php echo $my_image; ?>)"></div>
<?php else : ?>
<div class="slide-noimg"><?php _e('No featured image set for this post.', 'attorney') ?></div>
<?php endif; ?>
<?php endif; ?>
<div class="slide-content">
<div class="slide-copy">
<h2 class="slide-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'attorney' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
<?php echo attorney_excerpt(25); ?>
</div>
</div>
</div>
</div>
<?php endwhile; ?>
<?php wp_reset_query(); // reset the query ?>
</div>
<div class="slidernav">
<a id="sliderprev" href="#" title="<?php _e('Previous', 'attorney'); ?>"><?php _e('◀', 'attorney'); ?></a>
<a id="slidernext" href="#" title="<?php _e('Next', 'attorney'); ?>"><?php _e('▶', 'attorney'); ?></a>
</div>
<div class="clearfix"></div>
<?php else : ?>
<?php /* Start the Loop */ ?>
<?php while ( $fPosts->have_posts() ) : $fPosts->the_post(); ?>
<div class="slides">
<div id="post-<?php the_ID(); ?>" <?php post_class('post-theme'); ?>>
<?php if ( has_post_thumbnail()) : ?>
<div class="slide-thumb" style="background-image:url(<?php $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array(1000, 640), false, '' ); echo $src[0]; ?>)"></div>
<?php else : ?>
<div class="slide-noimg"><?php _e('No featured image set for this post.', 'attorney') ?></div>
<?php endif; ?>
<div class="slide-content">
<div class="slide-copy">
<h2 class="slide-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'attorney' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
<?php echo attorney_excerpt(25); ?>
</div>
</div>
</div>
</div>
<?php endwhile; ?>
<?php wp_reset_postdata(); // reset the query ?>
<?php endif; ?>
<?php endif; ?>
</div>
<?php while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class('alt_home'); ?>>
<div class="entry-content post_content">
<?php the_content(); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'attorney' ), 'after' => '</div>' ) ); ?>
</div><!-- .entry-content -->
</article><!-- #post-<?php the_ID(); ?> -->
<?php endwhile; // end of the loop. ?>
</div> <!-- end #main -->
</div> <!-- end #content -->
<?php get_footer(); ?>