-
Notifications
You must be signed in to change notification settings - Fork 0
/
page.php
157 lines (140 loc) · 4.31 KB
/
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
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<?php get_header(); ?>
<main id="mastwrapper">
<div class="container">
<h1 class="titulo-os">
<?php the_title(); ?>
<?php
$cat = strtolower(get_the_title());
$pagina = $cat;
switch($cat) {
case "android":
$pagina = $cat;
$taxonomia = "apps";
break;
case "ios":
$pagina = $cat;
$taxonomia = "apps";
$cat = "apple";
break;
case "gnu/linux":
$cat = "linux";
$pagina = $cat;
$taxonomia = "software";
break;
case "mac os":
$pagina = "mac";
$cat = "apple";
$taxonomia = "software";
break;
case "windows":
$taxonomia = "software";
break;
}
$pagina = $pagina . "_post_type";
echo "<i class='fa fa-$cat'></i>";
?>
</h1>
<!-- Contenedor de programas -->
<div class="programas-contenedor">
<!-- Comienza loop de categorías -->
<?php
$args = array(
'orderby' => 'name',
'parent' => 0,
'taxonomy' => $taxonomia,
'field' => 'slug'
);
$categorias = get_categories( $args );
foreach ( $categorias as $categoria ) {
$catName = $categoria->name;
$catSlug = $categoria->slug;
?>
<!-- Comienza loop de programas -->
<?php
$args = array(
'post_type' => $pagina,
'posts_per_page' => -1,
'orderby' => 'title',
'order' => 'ASC',
'tax_query' => array(
array(
'taxonomy' => $taxonomia,
'field' => 'slug',
'terms' => $catSlug,
),
),
);
$query = new WP_Query($args);
$contador = 0;
if ( have_posts() ) :
while($query->have_posts()) : $query->the_post();
?>
<!-- Categoría -->
<h3 class="programas-categoria">
<?php
$contador++;
if ( $contador == 1 )
echo $catName; ?>
</h3>
<!-- Termina categoría -->
<!-- Programa individual -->
<div class="programa-contenedor">
<!-- Logo del programa -->
<div class="programa-logo col-sm-4 col-md-2">
<div class="row">
<?php imagen_destacada(); ?>
</div>
</div>
<!-- Termina logo del programa -->
<!-- Info del programa -->
<div class="programa-info col-sm-8 col-md-10">
<p>
Nombre: <?php the_title(); ?>
</p>
<p>
Licencia: <?php the_field('licencia'); ?>
</p>
<p>
<?php
$url = get_field('sitio_web');
if ( $url != "" ) {
echo "<a href='$url' target='_blank'>Sitio web</a>";
}
?>
<?php
$url = get_field('git');
$github = "github";
$gitlab = "gitlab";
if ( $url != "" ) {
if ( strpos($url, $github) !== false ) {
echo "<a href='$url' class='fa fa-github' target='_blank'></a>";
} else if ( strpos($url, $gitlab) !== false ) {
echo "<a href='$url' class='fa fa-gitlab' target='_blank'></a>";
} else {
echo "<a href='$url' class='fa fa-git-square' target='_blank'></a>";
}
}
?>
</p>
<div class="programa-descripcion">
<?php the_content(); ?>
</div>
</div>
<!-- Termina info del programa -->
</div>
<!-- Termina programa individual -->
<?php
endwhile;
wp_reset_postdata();
endif;
?>
<!-- Termina loop de programas -->
<?php
}
?>
<!-- Termina loop de categorías -->
</div>
<!-- Termina contenedor de programas -->
</div>
</main>
<?php get_footer(); ?>