Wordpress - snippet de un bootstrap navbar de subcategorias

El siguiente código genera un navbar para ser usado con isotope en un tema de wordpress. El codigo ha sido reemplazado por html sencillo, sin embargo lo estoy guardando en este post para futuro temas.



<div class="row">
<div class="col-sm-8 col-md-6 col-sm-offset-2 col-md-offset-3 text-center">
<div class="btn-group btn-group-sm" role="group" id="filters">
<?php
$slugPortafolios = 'portafolios';
$objCategoryPortafolios = get_category_by_slug( $slugPortafolios );
$idCategoryPortafolios = $objCategoryPortafolios->term_id;
$terms = get_terms('category', array('parent' => $idCategoryPortafolios)); // you can use any taxonomy, instead of just 'category'
$terms_ID_array = array();

$count = count($terms); //How many are they?
if ( $count > 0 ){  //If there are more than 0 terms
foreach ( $terms as $term ) {  //for each term:
$terms_ID_array[] = $term->term_id; // Add each term's ID to an array
echo "<a role='button' class='btn btn-default'  href='#' data-filter='.".$term->slug."'>" . $term->name . "</a>\n";
//create a list item with the current term slug for sorting, and name for label
}
}
?>
</div>
</div>
</div>

Comentarios

Entradas más populares de este blog

Yahoo! UI (yui) TabView como menu horizontal.

Truco: usar Firefox en el portal IDSE del IMSS

Visual Web Express Edition con MS Access Membership