-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfront-page.php
35 lines (30 loc) · 923 Bytes
/
front-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
<div class="container">
<div class="row">
<?php
// WP_Query arguments
$args = array (
'post_type' => array( 'page' ),
'order' => 'ASC',
'orderby' => 'title',
);
// The Query
$query = new WP_Query( $args );
// The Loop
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post();
$image = get_post_meta( get_the_ID(), 'page_image');
$image_id = $image[0]; ?>
<div class="col-sm-4">
<a href="<?php the_permalink() ?>"><?php echo wp_get_attachment_image( $image_id, 'page-image' ); ?></a>
<h3><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h3>
</div>
<?php }
} else { ?>
<h2>You don't have any pages yet. Add some.</h2>
<?php }
// Restore original Post Data
wp_reset_postdata();
?>
</div>
</div>