PHP - Necesito sacar las categorias

 
Vista:

Necesito sacar las categorias

Publicado por Neron (2 intervenciones) el 16/05/2016 19:06:56
Buenas tardes compañeros,
dispongo del siguiente código en un template y la verdad que no consigo dar con la tecla para cambiar la busqueda y que me salgan por "categorias"
Ahora me salen ordenados en aleatorios, populares y + vistos.
Lo que quiero es mostrar un tipo de categoría, que yo le diga directamente cual, id 1, id 2 etc....

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
 
global $paged, $wp_query, $wp;
$args = wp_parse_args($wp->matched_query);
 
if ( !empty ( $args['paged'] ) && 0 == $paged ) {
 
	$wp_query->set('paged', $args['paged']);
 
	$paged = $args['paged'];
 
}
$ads_counter = $redux_demo['home-ads-counter'];
$arags =
	array(
		'post_type' => 'post',
		'posts_per_page' => $ads_counter,
		'paged' => $paged
	);
$wsp_query = new WP_Query($arags);
 
$current = -1;
$current2 = 0;
 
?>
 
<?php while ($wsp_query->have_posts()) : $wsp_query->the_post(); $current++; $current2++; ?>
 
	<div class="ad-box span3 latest-posts-grid <?php if($current%4 == 0) { echo 'first'; } ?>">
		<div class="ads-v2-thumb">
		<?php
			if ( has_post_thumbnail()) {
				$large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'large');
				echo '<a class="ad-image" href="' .get_permalink($post->ID). '" title="' . the_title_attribute('echo=0') . '" >';
				echo get_the_post_thumbnail($post->ID, '270x220');
				echo '</a>';
				}
		?>
		<?php
 
			$category = get_the_category();
 
			if ($category[0]->category_parent == 0) {
 
				$tag = $category[0]->cat_ID;
 
				$tag_extra_fields = get_option(MY_CATEGORY_FIELDS);
				if (isset($tag_extra_fields[$tag])) {
					$category_icon_code = $tag_extra_fields[$tag]['category_icon_code'];
					$category_icon_color = $tag_extra_fields[$tag]['category_icon_color'];
				}
 
			} else {
 
				$tag = $category[0]->category_parent;
 
				$tag_extra_fields = get_option(MY_CATEGORY_FIELDS);
				if (isset($tag_extra_fields[$tag])) {
					$category_icon_code = $tag_extra_fields[$tag]['category_icon_code'];
					$category_icon_color = $tag_extra_fields[$tag]['category_icon_color'];
				}
 
			}
 
			if(!empty($category_icon_code)) {
 
		?>
 
		<?php $category_icon = stripslashes($category_icon_code); ?>
 
		<?php }
 
		$category_icon_code = "";
 
		?>
 
			<div class="ads-vr-2-category-icon" style="background-color:<?php echo $category_icon_color; ?>"><span><?php echo $category_icon; ?></span></div>
 
		</div>
 
		<div class="post-title-cat">
 
			<div class="post-title">
				<a href="<?php the_permalink(); ?>"><?php $theTitle = get_the_title(); $theTitle = (strlen($theTitle) > 25) ? substr($theTitle,0,25).'...' : $theTitle; echo $theTitle; ?></a>



Gracias de antemano.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder