isaachorton
Forum Replies Created
-
This works.
add_filter( 'pre_get_posts', 'my_get_posts' ); function my_get_posts( $query ) { if ( ( is_home() && false == $query->query_vars['suppress_filters'] ) ) $query->set( 'post_type', array( 'tutorials' ) ); if ( ( is_archive() && false == $query->query_vars['suppress_filters'] ) ) $query->set( 'post_type', array( 'tutorials' ) ); return $query; }
The code below lists out all the terms in the taxonomy, but Id like to list only the associated post-types in the CURRENT category. In this case my taxonomy is “courses” and I just want to define the current term in “courses” and list the rest of the pages accordingly.
any clues how to accomplish this?<li id="brands" class="widget-container"> <?php $cam_brands = get_terms('courses', 'hide_empty=1'); ?> <ul> <?php foreach( $cam_brands as $brand ) : ?> <li> <a href="<?php echo get_term_link( $brand->slug, 'courses' ); ?>"> <?php echo $brand->name; ?> </a> <ul> <?php $wpq = array( 'post_type' => 'portfolio-item', 'taxonomy' => 'courses', 'term' => $brand->slug ); $brand_posts = new WP_Query ($wpq); ?> <?php foreach( $brand_posts->posts as $post ) : ?> <li> <a href="<?php echo get_permalink( $post->ID ); ?>"> <?php echo $post->post_title; ?> </a> </li> <?php endforeach ?> </ul> </li> <?php endforeach ?> </ul> </li>
Forum: Themes and Templates
In reply to: List custom post types for the current custom taxonomyHow do you use this on a sidebar.php?
I want to do this exact thing, but in my custom sidebar.php Every time I use this code I get unexpected results on the sidebar. Can someone post an actual code example for a sidebar?
ok i was wrong I cant get this to work anybody have a snippet of code for this?
ok figured it out. wasnt displaying becuase of the php function above it in the template.
this is solved.
<?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); query_posts($query_string . "&cat=".$term->term_taxonomy_id); ?>
Ok so how do i edit this to display the posts in the custom taxonomy?
i was thinking of modifying this bit… any suggestions?
// Get the selected terms for the post (if has more than one use the first) $term = wp_get_object_terms($post->ID, 'Filters'); if ( $term ) { $term = $term[0]; } //now you can use $term->slug, $term->name, $term->term_id, etc
I cant find the code to simply list all the (custom-post-type)titles with links in a particular custom taxonomy.
For instance, I want to have a list of associated posts in a particular category but the category is a custom taxonomy and the posts are a custom post type. What would be the code to list just titles with links from the associated category?
Also, is there a way to define the current category in a custom taxonomy? Let’s pretend that there is always only one category in each taxonomy associated with each post. I want to define the current category within a defined custom taxonomy… then list all it’s contents. Is there a way to do that?
These custom posts/taxonomies have me scratching my head a bit…. lol!
Forum: Themes and Templates
In reply to: New MODERN theme KATEGORIKA 2.0 – super clean – minimalThere is room for putting pictures inside the content. The pictures that load on the homepage and the archives/category/tag/search pages are all the same pictures being shown at different sizes. This is accomplished by using the custom fields feature of WordPress.
This theme uses Sandbox for semantic class definitions and I based the homepage on an idea I got from “Aperio”, a theme developed by Robert Ellis of Futurosity.
Forum: Plugins
In reply to: Creating a Timeline Visualization of Posts and Pagesok the html did not come through for the nesting I am trying to illustrate. Here is an example trying to show it in plain text.
– Year
| – Month
– – | – Listings
– – | – Listings
– – | – Listings
– – Month
– – | – Listings
– – | – Listings
– Year
| – Month
– – | – Listings
– – | – Listings
– – | – Listings
– – Month
– – | – Listings
– – | – ListingsForum: Themes and Templates
In reply to: Creating a search page which separates Posts from Pages?Does anyone know how to accomplish this? Ive tried to find a code example somewhere with no luck. I was hoping to remove the date from my search results when a Page is listed. In my site which is currently running WP 2.5.1 the pages are displayed first but with an annoying date format next to each Page listing. I want the rest of the search results to be displayed exactly how they are now. For Posts, the date is appropriate.
here is the example search results with Pages and Posts shown together:
https://kre8.tv/?s=music
I’ve tried using a conditionalis_page
inside the loop but with no success. I was thinking I could accomplish this using multiple loops but have not been able to find an example of this type of Page/Post separation inside a search.php template.Any tips with code examples would be greatly appreciated! Thanks!