Seijun
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Custom Taxonomies and feedsNo problem. You can also find it by searching the forum for taxonomy shortcode. Here is the topic:
http://wordpress.org/support/topic/display-custom-taxonomy-output-within-posts-1And here is the code, goes in functions.php:
function get_tax() { global $post; $tax_and_terms = ''; $tax_and_terms .= strip_tags( get_the_term_list( $post->ID, 'gender', '<dl><dt>Gender: </dt><dd>', ', ', '</dd>' ), '<dl><dt><dd>' ); $tax_and_terms .= strip_tags( get_the_term_list( $post->ID, 'age', '<dt>Age: </dt><dd>', ', ', '</dd>' ), '<dl><dt><dd>' ); $tax_and_terms .= get_the_term_list( $post->ID, 'location', '<dt>Loc: </dt><dd>', ', ', '</dd>' ); $tax_and_terms .= strip_tags( get_the_term_list( $post->ID, 'status', '<dt>Status: </dt><dd>', ', ', '</dd>' ), '<dl><dt><dd>' ); $tax_and_terms .= get_the_term_list( $post->ID, 'contact', '<dt>Contact: </dt><dd>', ' or ', '</dd></dl>' ); return $tax_and_terms; } add_shortcode('tax', 'get_tax');The shortcode “tax” will output the terms for my custom taxonomies (gender, age, status, location, and contact) in definition list form. Strip tags is used to keep some terms from linking to their taxonomy archive pages. Working example is here:
http://wolfdogrescue.net/adoption/all-available/male/amarook-nv/Forum: Fixing WordPress
In reply to: Custom Taxonomies and feedsI almost didn’t. A very nice member here helped me write a shortcode to insert my custom taxonomy info directly into the post. Now it shows up in feeds also.
Forum: Fixing WordPress
In reply to: can't search in media libraryI have this same problem! Say I have the image “taz1.jpg”. Searching for “taz” or even “taz1” returns “No media attachments found.”
Forum: Hacks
In reply to: Display custom taxonomy output within postsYou are awesome!
Thank you so much, you have made my life infinitely easier today.
For anyone interested, my final code isfunction get_tax() { global $post; $tax_and_terms = ''; $tax_and_terms .= strip_tags( get_the_term_list( $post->ID, 'gender', '<dl><dt>Gender: </dt><dd>', ', ', '</dd>' ), '<dl><dt><dd>' ); $tax_and_terms .= strip_tags( get_the_term_list( $post->ID, 'age', '<dt>Age: </dt><dd>', ', ', '</dd>' ), '<dl><dt><dd>' ); $tax_and_terms .= get_the_term_list( $post->ID, 'location', '<dt>Loc: </dt><dd>', ', ', '</dd>' ); $tax_and_terms .= strip_tags( get_the_term_list( $post->ID, 'status', '<dt>Status: </dt><dd>', ', ', '</dd>' ), '<dl><dt><dd>' ); $tax_and_terms .= get_the_term_list( $post->ID, 'contact', '<dt>Contact: </dt><dd>', ' or ', '</dd></dl>' ); return $tax_and_terms; } add_shortcode('tax', 'get_tax');Forum: Hacks
In reply to: Display custom taxonomy output within postsThanks. And for allowing certain tags? This seemed logical, but didn’t work.
$tax_and_terms .= strip_tags( get_the_term_list( $post->ID, 'gender' <dl><dt>Gender: ', ', ', '</dt>' )$tax_and_terms, '<dl><dt>,<dd>, ' );Forum: Hacks
In reply to: Display custom taxonomy output within postsThanks, that helped a lot!
I need the strip_tags though to remove the url that is attached to every term. I only want the terms for “loc.” and “contact” to be links. Strip_tags was removing my dl/dt tags as well so I had those added back in. How do I add strip_tags back to the new code?Forum: Hacks
In reply to: Display custom taxonomy output within postsI replaced echo with return and replaced the_terms with get_the_terms. After replacing echo with return the output is now within the post, but only shows the first taxonomy in the list (gender:female)
function get_tax() { $terms_as_text = get_the_term_list( $post->ID, 'gender', '<dl class="my-stats2"><dt>Gender: </dt><dd>', ', ', '</dd>' ) ; return strip_tags($terms_as_text, '<dl><dt>,<dd>, '); $terms_as_text = get_the_term_list( $post->ID, 'age', '<dt>Age: </dt><dd>', ', ', '</dd>' ) ; return strip_tags($terms_as_text, '<dt>,<dd>, '); get_the_terms( $post->ID, 'location', '<dt>Loc: </dt><dd>', ', ', '</dd>' ); $terms_as_text = get_the_term_list( $post->ID, 'status', '<dt>Status: </dt><dd>', ', ', '</dd>' ) ; return strip_tags($terms_as_text, '<dt>,<dd>, '); get_the_terms( $post->ID, 'contact', '<dt>Contact: </dt><dd>', ' or ', '</dd></dl>' ); } add_shortcode('tax', 'get_tax');It’s not moving on the the second item in the list. I’m guessing there is something else I need to separate each “get_the_terms” statement, but I have no idea what.
Forum: Hacks
In reply to: Display custom taxonomy output within postsOk, I’ve been working on this some more, and I’ve got the shortcode to render the php, but it’s still putting the output ABOVE the post and not in it. Please, PLEASE help me out if you can. My code is as follows:
function get_tax() { $terms_as_text = get_the_term_list( $post->ID, 'gender', '<dl class="my-stats"><dt>Gender: </dt><dd>', ', ', '</dd>' ) ; echo strip_tags($terms_as_text, '<dt>,<dd>, '); $terms_as_text = get_the_term_list( $post->ID, 'age', '<dt>Age: </dt><dd>', ', ', '</dd>' ) ; echo strip_tags($terms_as_text, '<dt>,<dd>, '); the_terms( $post->ID, 'location', '<dt>Loc: </dt><dd>', ', ', '</dd>' ); $terms_as_text = get_the_term_list( $post->ID, 'status', '<dt>Status: </dt><dd>', ', ', '</dd>' ) ; echo strip_tags($terms_as_text, '<dt>,<dd>, '); the_terms( $post->ID, 'contact', '<dt>Contact: </dt><dd>', ' or ', '</dd></dl>' ); } add_shortcode('tax', 'get_tax');Forum: Hacks
In reply to: Display custom taxonomy output within postsOk, I have the shortcode part figured out, but I don’t know how to make the shortcode use a block of php without getting errors. Here is my shortcode code:
function get_tax() { return 'php code here'; } add_shortcode('tax', 'get_tax');And this is the php code I want the shortcode to execute (displays a list of taxonomy terms associated with the post):
<dl class="my-stats"> $terms_as_text = get_the_term_list( $post->ID, 'gender', '<dt>Gender: </dt><dd>', ', ', '</dd>' ) ; echo strip_tags($terms_as_text, '<dt>,<dd>, '); $terms_as_text = get_the_term_list( $post->ID, 'age', '<dt>Age: </dt><dd>', ', ', '</dd>' ) ; echo strip_tags($terms_as_text, '<dt>,<dd>, '); the_terms( $post->ID, 'location', '<dt>Loc: </dt><dd>', ', ', '</dd>' ); $terms_as_text = get_the_term_list( $post->ID, 'status', '<dt>Status: </dt><dd>', ', ', '</dd>' ) ; echo strip_tags($terms_as_text, '<dt>,<dd>, '); the_terms( $post->ID, 'contact', '<dt>Contact: </dt><dd>', ' or ', '</dd>' ); </dl>Can anyone help, please?
Forum: Hacks
In reply to: Showing custom taxonomy post count in sidebar*bump*
Forum: Fixing WordPress
In reply to: Difference between these two exclusion conditionals?So basically one just deletes the sidebar and the other also deletes the sidebar but also gives the option to replace it with something else..
Forum: Plugins
In reply to: [Plugin: Query Multiple Taxonomies] Loosing stuff on results page<?php $term = get_term_by( 'slug', get_query_var('tag'), 'post_tag' ); if ( $term ) echo term_description( $term->term_id, 'post_tag' ); ?>Did not work. Neither did these variations:
<?php echo term_description( '', get_query_var( 'taxonomy' ) ); ?><?php $termDescription = term_description( '', get_query_var( 'taxonomy' ) ); if($termDescription != '') : ?> <div class="tag-desc"><?php echo $termDescription; ?></div> <?php endif; ?><?php $termdescription = term_description(); if ( ! empty( $termdescription ) ) echo '' . $termdescription . ''; ?>Forum: Plugins
In reply to: [Plugin: Query Multiple Taxonomies] Loosing stuff on results pageWould just plain is_multitax() work for both all muti tax and single tax pages, or does my conditional also need to include is_tax for single tax pages?
Here is the code for my description. I got this from a tutorial on making tax archive pages. Sorry if the answer is obvious, I don’t really know any php.
<?php if ( tag_description() !== '' ) { ?> <?php echo tag_description(); ?> <?php } ?>Forum: Hacks
In reply to: Custom taxonomies: getingt rid of link on display??Putting get_terms instead of get_the_terms also has no effect.
Forum: Hacks
In reply to: Custom taxonomies: getingt rid of link on display??@ aut0poietic:: Thank you for taking the time to reply. I tried the code in your last post
$terms = get_the_terms( $post->ID, 'operating_system', "fields=names") ;But the results were same as before. No output of any kind, as if the code did not even exist.