-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate-home-page.php
36 lines (24 loc) · 1.74 KB
/
template-home-page.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
<?php /* Template Name: Template Home Page */ get_header(); ?>
<div class="home-images">
<?php
$myposts = get_posts('numberposts=15&category_name=Featured');
foreach($myposts as $post) : ?>
<?php
if ( wp_is_mobile() ) { ?>
<div class="home-image" >
<amp-img src="<?php $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'homepage-slider-mobile' ); echo $thumb['0'];?>" height="11.1" width="16" alt="<?php $thumb_id = get_post_thumbnail_id(get_the_ID()); $alt = get_post_meta($thumb_id, '_wp_attachment_image_alt', true); if( $alt ): echo $alt; endif; ?>" layout="responsive" ></amp-img>
<h2>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
</h2>
</div>
<?php } else { ?>
<div class="home-image" >
<amp-img class="home-image" src="<?php $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'homepage-slider' ); echo $thumb['0'];?>" height="11.1" width="16" alt="<?php $thumb_id = get_post_thumbnail_id(get_the_ID()); $alt = get_post_meta($thumb_id, '_wp_attachment_image_alt', true); if( $alt ): echo $alt; endif; ?>" layout="responsive" ></amp-img>
<h2>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
</h2>
</div>
<?php } ?>
<?php endforeach; ?>
</div>
<?php get_footer(); ?>