Issue with sidebar widgets not showing when I do custom queries

When you do a query, you change the environment, specifically the current post and query objects. To reset things back to how they were before the query loop you should: query_posts(‘post_type=offered’); if(have_posts(){ while (have_posts()) : the_post(); ?> ….content endwhile; } wp_reset_query(); // reset query!!!! or $wanted_query = new WP_Query(‘post_type=wanted’); if($wantedquery->have_posts()){ while ($wanted_query->have_posts()) : $wanted_query->the_post(); ….content … Read more

Can you have seperate sidebars for multiple taxonomy archives?

I’ve had luck dynamically creating sidebars using a foreach loop. You’d do something like this (untested) in your functions.php file: $my_terms = get_terms( ‘my_taxonomy_name’ ); if( ! is_wp_error( $my_terms ) ) { foreach( $my_terms as $term ) { register_sidebar( ‘name’ => $term->name . ‘ Archive Sidebar’, ‘id’ => ‘archive_sidebar_’ . $term->term_id ); } } Then, … Read more

Exclude current post ID from loop in sidepbar.php

First, do not use query_posts() for secondary loops. The query_posts() function is intended only to modify the primary loop query. Use WP_Query() or get_posts() for secondary loop queries. Also, showposts is deprecated. Use posts_per_page instead. Let’s use WP_Query(), as it will be the most analogous to your current implementation: <?php // First, let’s eliminate some … Read more

Any available action to add content before and after sidebar?

You can create your own actions using do_action, like this: <?php do_action(‘before_sidebar’); // you can name it whatever you want ?> <?php if ( is_active_sidebar(‘main-sidebar’) ) : ?> <ul> <?php dynamic_sidebar(‘main-sidebar’); ?> </ul> <?php endif; ?> <?php do_action(‘after_sidebar’); ?> and use add_action() normally: add_action(‘before_sidebar’, ‘before_sidebar_function’); add_action(‘after_sidebar’, ‘after_sidebar_function’); UPDATE: depending on the codex you can use … Read more

What is the best way to change sidebars based on custom taxonomy terms?

There are 2 options that comes in mind First use a conditional statement is_tax(‘taxonomy-name’, ‘term name’). is_tax(‘fruits’, ‘apples’){ get_sidebar(‘apples’); get_sidebar(‘apples-right’); } if is_tax(‘fruits’, ‘oranges’) { get_sidebar(‘oranges’); get_sidebar(‘oranges-right’); } Or, the second option, use a different template file instead. taxonomy-fruits-apples.php should use get_sidebar(‘apples’); get_sidebar(‘apples-right’); taxonomy-fruits-oranges.php should use get_sidebar(‘oranges’); get_sidebar(‘oranges-right’); Hope this help

archive page sidebar not working

It working now this is the right template with the code i should use Thanks for help <?php /** * Archive Template * * Displays an Archive index of post-type items. Other more specific archive templates * may override the display of this template for example the category.php. * * @package Thematic * @subpackage Templates … Read more

Use ajax request to load sidebar

I didn’t test anything, but I imagine it would be something like this: As you must include a sidebar.php, just include an empty sidebar.php, and leave the real one to the sidebar-ajax.php, for example. To call the sidebar: <?php get_template_part(‘sidebar’); ?> And it should be something like this: <div id=”sidebar”></div> In your functions.php: add_action(‘wp_enqueue_scripts’, ‘theme_enqueue_scripts’); … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)