widgets in contacts only

there are many plugins for that, try this one, its pretty easy: http://wordpress.org/extend/plugins/widget-context/ or if you dont want to use a plugin, add a new sidebar to the specific page u desire: http://www.blogohblog.com/adding-extra-sidebar-to-your-wordpress-theme/

redirect old pages by .htaccess

%postname% is not a mod_rewrite rewrite tag. You are going to have to write out the path. mod_rewrite operates before WordPress, or PHP, gets involved. You don’t have access to any of that functionality. If your “contact” page– the page named “contact”– has ID 213 you shouldn’t have to do anything to redirect, though. This … Read more

Mysql query and odd results

You have to enclose the OR part to brackets: $sql = “SELECT ID,post_title,post_content,post_date,post_type FROM {$wpdb->posts} WHERE (post_content LIKE {$stuff}) AND post_status=”publish” AND post_type=”{$post_type}” AND ID != {$post->ID} LIMIT {$limit}”; $results= $wpdb->get_results($sql); Try this one: SELECT ID,post_title,post_content,post_date,post_type FROM wp_posts WHERE (post_content LIKE ‘%Battery%’ OR post_content LIKE ‘%Watcher%’ OR post_content LIKE ‘%Widget%’ OR post_content LIKE ‘%matches%’ OR … Read more

Show only one category in main query, issues on tag page

If the only issue you want to correct is the output of single_tag_title, you can correct the value via a filter by grabbing the tag query var directly: function wpa90852_fix_tag_title(){ $tag = get_term_by( ‘slug’, get_query_var(‘tag’), ‘post_tag’ ); return $tag->name; } add_filter( ‘single_tag_title’, ‘wpa90852_fix_tag_title’ );

URL Redirect in WordPress

For this kind of rewriting, I’m using this code (haven’t tested this one exactly, so may contain minor bugs): add_filter( ‘query_vars’, ‘binda_query_vars’ ); function binda_query_vars( $vars ) { $vars[] = ‘pp’; return $vars; } add_action( ‘generate_rewrite_rules’, ‘binda_rewrite_rules’ ); function binda_rewrite_rules( $wp_rewrite ) { $wp_rewrite->rules = array( ‘news/([0-9]{1,})/([0-9]{1,})/?$’ => $wp_rewrite->index . ‘?post_type=news’ . ‘&pp=’ . $wp_rewrite->preg_index( … Read more

Problem with custom post type search

This is not related only to your custom post_types search. WordPress has a problem on empty search on itself. I use this simple code snippet as workaround: add_filter( ‘request’, ‘my_request_filter’ ); function my_request_filter( $query_vars ) { if( isset( $_GET[‘s’] ) && empty( $_GET[‘s’] ) ) { $query_vars[‘s’] = ” “; } return $query_vars; } You … Read more

WordPress a template for subcategories fo a given category, but not for root category

I managed to solve this in a procedural way: 1 added in theme function this snippet: add_action(‘template_redirect’, ‘load_category_tree_template’); function load_category_tree_template() { if (is_category() && !is_feed()) { // replace ‘your-base-category-slug’ with the slug of root category $base_tree_cat_id = get_cat_id(‘your-base-category-slug’); // get current category id $catid = get_query_var(‘cat’); if (is_category($base_tree_cat_id) || cat_is_ancestor_of($base_tree_cat_id, $catid)) { load_template(STYLESHEETPATH . ‘/category-your-base-category-slug.php’); … Read more

Show content based on width?

As you said making a part responsive would be the best way you can choose. Working with screen width is some thing client side, and that’s done by CSS or alternatively by Javascript. If it’s related to css, media queries will do the job: http://www.ibm.com/developerworks/library/wa-cssqueries/index.html and if it’s js, width property of screen object does … Read more