melbo
Forum Replies Created
Viewing 4 replies - 1 through 4 (of 4 total)
-
Forum: Fixing WordPress
In reply to: Sidebar shortcodeWith alchymyth’s help I managed to rewrite the code as follows:
// Sidebar Shortcode function shortcode_sidebar( $atts, $content = null ) { extract(shortcode_atts(array( 'type' => 'vertical' ), $atts)); if ($type == 'horizontal') { ob_start(); include(TEMPLATEPATH."/footer_sidebar.php"); $string_to_return = ob_get_contents(); ob_end_clean(); return $string_to_return; } else { ob_start(); get_sidebar(); $string_to_return = ob_get_contents(); ob_end_clean(); return $string_to_return; } } add_shortcode('sidebar', 'shortcode_sidebar');And it works.
Thanks a lot!
Thanks a lot keesiemeijer, it worked like a wonder.
Wonderful! It works. What if i want to assign more than one slug to a class?
@keesiemeijer thanks to you I checked again and actually $term->count was working. I don’t know what I was that I did wrong.
So what is left now is the second part of my problem. How can I get the category slug name of the term inside the loop so I can assign it to each item in a class
<?php $args = array( 'post_type' => 'portfolio', 'posts_per_page' => 99 ); $loop = new WP_Query( $args ); $post_number = 0; ?> <ul id="portfolio-grid"> <?php while ( $loop->have_posts() ) : $loop->the_post(); ?> <li class=""><?php echo the_title() ?> </li> <?php endwhile; ?> </ul>
Viewing 4 replies - 1 through 4 (of 4 total)