How can I filter posts by tag on the fly
Are you not looking for a simple widget like Cat + Tag Filter? This plugin gives your visitors an ability to filter all your posts by a category or/and tag.
Are you not looking for a simple widget like Cat + Tag Filter? This plugin gives your visitors an ability to filter all your posts by a category or/and tag.
Use the is_category() WordPress function to determine if you are in a category template. <?php /** * Alternate Sidebar Template * * If a `secondary` widget area is active and has widgets, * and the selected layout has a third column, display the sidebar. * * @package WooFramework * @subpackage Template */ // If this … Read more
You can place another loop on the template, for example below the first loop. Multiple loops documentation: http://codex.wordpress.org/The_Loop#Multiple_Loops_Example_1 <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <!– your first loop … –> <?php endwhile; ?> <?php endif; ?> <?php wp_reset_query(); $tips_query = new WP_Query( ‘category_name=tips&posts_per_page=1’ ); ?> <?php if ($tips_query->have_posts()) : ?> … Read more
If I understand you correctly, you want to display the parent Categories themselves, and not their posts, correct? get_terms is what you need. $top_level_categories = get_terms( ‘category’, array( ‘parent’ => 0, // This will get ONLY top level items ‘hide_empty’ => false // This will make sure even empty categories are returned ) ); print_r( … Read more
I think you can go even simpler in the coding. Just add the below to your functions.php file within your theme folder. function myFeedExcluder($query) { if ($query->is_feed) { $query->set(‘cat’,’-73,-9′); // categories 73 and 9 are being excluded } return $query; } add_filter(‘pre_get_posts’,’myFeedExcluder’); Note particularly that multiple categories can be excluded by separating them with commas. … Read more
Your question implies that index.php is a page to be redirected to, it isn’t, it’s purely a template file. It implies that single.php being loaded is what makes a page singular, or that loading the page.php template will give you a page, when it’s actually the other way around. I strongly recommend reading about the … Read more
What about using the UNION? Just an example: (SELECT * FROM $wpdb->posts (with JOIN and WHERE as needed)) UNION (SELECT * FROM $wpdb->posts (with WHERE to select pages)) GROUP BY/ORDER BY The select(s) must be in parenthesis to use an order by for the whole union result. As a second option, you can use a … Read more
Relative URLs are best avoided in WP, so use absolute URLs instead. Also, you should load javascript files using the correct method, ie by using the wp_enqueue_script() function hooked to the wp_enqueue_scripts action hook. Doing both of these things will sort out your issue. Using wp_enqueue_script() will also allow you to define dependencies so, for … Read more
I think you might mean is_category()? Codex: is_category()
If I’m not wrong a the_post() function will take the post info into the loop. If so, then the the_title() and the_post_thumbnail() will do the rest for you. <?php //display random sorted list of terms in a given taxonomy $counter = 0; $max = 5; //number of categories to display $taxonomy = ‘category’; $terms = … Read more