webgdawg
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Filter Categories Based on Another CategoryThe default behavior for the drop down is to take you to the selected category, in your case the country page which is not what you want.
You can do this leveraging the WordPress plugin hooks, the question which hooks are best…
You could add hidden input field that stores the value of the volunteer-opp. category (63) passing that in the get url. You would check for this $_GET variable using the init hook (you want to catch it before WP turns it into a permalink), set a global variable with the value of the hidden field.
No in your template file you can check for the global variable and modify the query using query_posts
So basically you are using a hidden field in the form to capture the extra category to filter by, capturing it with the init hook and then using query_posts to modify the call to get the posts accordingly.
Forum: Fixing WordPress
In reply to: Filter Categories Based on Another CategoryCan you help me understand what behavior you see and what you want. My assumption is you see:
The dropdown is listing out all the countries, when selected taking you to the category page for that country with all posts listed.You want to see:
A dropdown listing out all the countries, when selected it takes you to a filtered category page, only listing the volunteer-opportunities for the selected countryAlso to clarify – is 63 the volunteer-opportunities and 4 the parent category for all African countries?
Forum: Fixing WordPress
In reply to: spell check in 2.6I had the same issue. I did a file compare and found some differences in the /wp-includes/js/tinymce/tiny_mce_config.php
I made the following changes to the 2.6 file based on difference I saw in the 2.5.1 code. My site isn’t ssl so I not sure why this made a difference, or if it was something in cache that was flushed out… I upgraded some local instances of WordPress from 2.5.1 to 2.6 and didn’t have the issue.
2.6 Code lines 53-59:
// Set up init variables $baseurl = includes_url('js/tinymce'); $mce_css = $baseurl . '/wordpress.css'; $mce_css = apply_filters('mce_css', $mce_css); $mce_locale = ( '' == get_locale() ) ? 'en' : strtolower( substr(get_locale(), 0, 2) ); // only ISO 639-1New Code:
// Set up init variables $baseurl = includes_url('js/tinymce'); //Added based on 2.5.1 file if ( is_ssl() ) $baseurl = str_replace('http://', 'https://', $baseurl); $mce_css = $baseurl . '/wordpress.css'; $mce_css = apply_filters('mce_css', $mce_css); //Added based on 2.5.1 file if ( is_ssl() ) $mce_css = str_replace('http://', 'https://', $mce_css); $mce_locale = ( '' == get_locale() ) ? 'en' : strtolower( substr(get_locale(), 0, 2) ); // only ISO 639-1This also fixed an issue I was having with the link editor in IE.
You may need to flush the js cache on your server, I have a plugin that adds and removes buttons in TinyMCE that does that for me…
Gregory
Forum: Themes and Templates
In reply to: Creating a search page which separates Posts from Pages?I was not satisfied with the results I got from that. I wanted to show a set number of results per area (5) and this simply returned the top 10 results, which in my case were all pages…
This lead me to creating custom queries. The only issue I ran into was the next and previous links wouldn’t work.Thanks to a comment by Aaron Harun over at: weblogtoolscollection I was able to find a solution to that issue. The new code is as follows:
<?php $page_query = new WP_Query("s=$s&paged=$paged&showposts=5&post_type=page"); //$page_query->query_vars['post_type']='page';//query_posts("s=$s&paged=$paged&cat=-1,-11,-101"); $post_query = new WP_Query("s=$s&paged=$paged&showposts=5&post_type=post"); //$post_query->query_vars['post_type']='post';//query_posts("s=$s&paged=$paged&cat=-1,-11,-101"); if ($page_query->have_posts()) : $wp_query= null; $wp_query = clone $page_query;?> <div class="navigation"> <div class="left"><?php previous_posts_link(' « Prev') ?></div> <div class="right"><?php next_posts_link('Next »'); ?></div> </div> <h2 class="pagetitle">Page Search Results</h2> <?php while ($page_query->have_posts()) : $page_query->the_post(); ?> <!-- do stuff --> <?php endwhile; ?> <?php endif;?> <?php if($post_query->have_posts()) : if(!$page_query->have_posts()) {$wp_query= null; $wp_query = clone $post_query;} ?> <h2 class="pagetitle">Post Search Results</h2> <?php while ($post_query->have_posts()) : $post_query->the_post(); ?> <!-- do stuff --> <?php endwhile; ?> <div class="navigation"> <div class="left"><?php previous_posts_link(' « Prev') ?></div> <div class="right"><?php next_posts_link('Next »'); ?></div> </div> <?endif; ?> <?php if (!$page_query->have_posts() && !$post_query->have_posts()) : ?> <h2 class="center">No results were found. Please try a different search?</h2> <?php include (TEMPLATEPATH . '/searchform.php'); ?> <?php endif; ?>Forum: Themes and Templates
In reply to: Creating a search page which separates Posts from Pages?is_page() is used to describe the page/template the results are on, not the individual results. So it is checking to see if your search results page is_page().
To look at the individual results you want to look at the $post object that is returned by the query, specifically you want to view the page_type. The complete search.php template would follow this…
<?php if (have_posts()) : ?> <h2 class="pagetitle">Page Search Results</h2> <?php while (have_posts()) : the_post(); ?> <?php if ($post->post_type == 'page') : ?> Show Page results <?php endif; ?> <?php endwhile; ?> <?php rewind_posts(); ?> <h2 class="pagetitle">Post Search Results</h2> <?php while (have_posts()) : the_post(); ?> <?php if ($post->post_type != 'page') : ?> Show non-page results <?php endif; ?> <?php endwhile; ?> <?php else : ?> No Results <?php endif; ?>