-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfront-page.php
More file actions
executable file
·84 lines (76 loc) · 2.6 KB
/
Copy pathfront-page.php
File metadata and controls
executable file
·84 lines (76 loc) · 2.6 KB
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
<?php
/** Este archivo hace una personalización de la página principal desde el backend.
* Por lo tanto si definimos una pagina estatica de inicio, se mostrara el contenido y bloques
* de la misma, pero además el código que pudiesemos poner aqui.
*/
get_header(); ?>
<main class='container '>
<?php
if(have_posts( )){
while(have_posts( )){
the_post( );
?>
<br>
<?php the_content( ); ?>
<?php
}
}
?>
<div class="lista-productos my-5">
<h2 class="text-center text-light">PRODUCTOS</h2>
<div class="row">
<div class="col-12">
<select class="form-control" name="categorias-productos" id="categorias-productos">
<option value="">Todas las categorias</option>
<?php $terms=get_terms('categoria-productos',array('hide_empty'=> true )); // se obtienen los terminos de una taxonomia
?>
<?php
foreach($terms as $term){
echo '<option value=" '.$term->slug.' ">'; //se usara para el ajax
echo $term->name;
echo '</option>';
}
?>
</select>
</div>
</div>
<div id="resultado-productos" class="row justify-content-center">
<?php
$args = array(
'post_type' => 'producto',
'post_per_page' => -1,
'order' =>'ASC',
'orderby' =>'title'
);
$productos= new WP_Query($args); // el WPQuery puede llevar muchisimos más argumentos para traer diferentes posts.
if($productos->have_posts()){
while($productos->have_posts( )){
$productos->the_post( );
?>
<div class="col-4">
<div class="card my-3 text-white bg-dark">
<?php
the_post_thumbnail('medium',array('class'=>'card-img-top'));
?>
<div class="card-body ">
<h5 class="card-title"><?php the_title( ) ?></h5>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
<a href="<?php the_permalink() ?>" class="btn btn-primary">ver más</a>
</div>
</div>
</div>
<?php
}
}
?>
</div>
</div>
<div class="row">
<div class="col-12">
<h1>Novedades</h1>
</div>
<div id="resultado-novedades" class="row">
</div>
</div>
</main>
<?php get_footer(); ?>