Michael Fields
Forum Replies Created
-
Forum: Plugins
In reply to: [Taxonomy Images] Trouble incorporating taxonomy images into existing codeMaybe something like this might work (untested):
$categories = apply_filters( 'taxonomy-images-get-terms', '', array( 'term_args' => array( 'child_of' => $cat, 'depth' => 1 ) ) );
I would like the order to be changed to- newest taxonomy to oldest taxonomy.
Unfortunately, WordPress does not store date information for each term. Technically, this is not really possible. You can work around this by setting the order argument of
get_terms()
to DESC. IF theorderby
argument is left to it’s default value, the terms will returned in the order which they were added to the database.This can be very misleading as
term_id
‘s are shared across taxonomies.For example. IF you have a category named “Taco” that you created last year and then you add a tag named “Taco” right now. Theterm_id
will not change. WordPress will recycle theterm_id
,name
andslug
from the term added last year.The next best solution might be to hook into the
'get_terms_orderby'
hook and modify it to useterm_taxonomy_id
only for the current call to get_terms(). Just be sure to set thecache_domain
argument to something unique to your site if going this route.Even at this stage … this is still a bit hacky IMHO. Terms will be returned in the order that they were entered into the database, which should “work” but is still not perfect. Auto incremented numeric keys should never be trusted to be in any sort of order – rather only as unique identifiers.
Unfortunately, this plugin does not support modifying the
order
argument at the present time. I’ve been working on-and-off on a complete rewrite of this plugin with template support + full support of the Taxonomy Images plugin. May be time to finish it up and release it!Best,
-MikeForum: Plugins
In reply to: [Taxonomy Images] Trouble incorporating taxonomy images into existing codeWhat function are you using to define the categories variable? If you are using on of the supported filters from the Taxonomy Images plugin, you can use $cat->image_id.
Maybe:
$categories = apply_filters( 'taxonomy-images-get-terms', '' );
I notice that you are using
<?php print apply_filters( 'taxonomy-images-queried-term-image', '' ); ?>
. This should not be in loops … it was designed to be used only in term archive templates like category.php and tags.php.Forum: Plugins
In reply to: [Taxonomy Images] Adding Taxonomy image to a single postHave you tried the “taxonomy-images-list-the-terms” filter? Tis is probably your best bet. Something like this maybe:
<?php print apply_filters( 'taxonomy-images-list-the-terms', '', array( 'after' => '</ul>', 'after_image' => '</li>', 'before' => '<ul class="taxonomy-images-the-terms">', 'before_image' => '<li>', 'image_size' => 'thumbnail', 'post_id' => 0, 'taxonomy' => 'category', ) ); ?>
Forum: Plugins
In reply to: [Taxonomy Images] Displaying on the home page or in WidgetsThere is a filter built-in that funtions very closely to get_terms(). I would suggest starting there.
Forum: Plugins
In reply to: [Taxonomy Images] [Plugin: Taxonomy Images] Hide_emptyAnything added to the
term_args
argument will be passed – unmodified – to get_terms().From the docs:
term_args (array) Arguments to pass to get_terms() as the second parameter. Default value is an empty array.
Forum: Fixing WordPress
In reply to: Adding Custom Taxonomy Images to Custom Post TypeGlad it worked. This plugin should be adding no extra css to your template files. I’m not sure where the border is coming from, but some themes do add borders to images in certain places. You could try something like:
.icon img { border-width:0 !important; }
but it would be better to fix this with a more specific selector:
#container .icon img { border-width:0; }
Best,
-MikeForum: Fixing WordPress
In reply to: Adding Custom Taxonomy Images to Custom Post TypeNo worries… you need to put the code in php tags like this:
<?php print apply_filters( 'taxonomy-images-list-the-terms', '', array( 'image_size' => 'detail', 'taxonomy' => 'eligibility', 'after' => '</div>', 'after_image' => '</span>', 'before' => '<div class="icon">', 'before_image' => '<span>', ) ); ?>
Forum: Fixing WordPress
In reply to: Adding Custom Taxonomy Images to Custom Post TypePlease see the section named List term images associated with a post object on the plugin page. This explains the function that you need to use and how to customize it.
Placing the following in the loop of your custom post_type archive template should get you started:
print apply_filters( 'taxonomy-images-list-the-terms', '', array( 'image_size' => 'detail', 'taxonomy' => 'country', ) );
Forum: Fixing WordPress
In reply to: Form included via shortcode showing stray "1" below submit buttonNo problem!
I did have content displaying both before and after the shortcode in the sidebar – being called in via the sidebar template file – and it actually came out fine. Should it not have?
Honestly, I have no idea ?? I know that printing would not. Never tried it with an included file though. Take for instance the following scenario:
functions.php
add_shortcode('inquiry','inquiry_function'); function inquiry_function() { print '<p>PRINT</p>'; return '<p>THIS IS THE RETURN VALUE</p>'; }
Post Content:
Up Top. [inquiry] Down Below.
Whe you view the post, the following is generated:
PRINT Up Top. THIS IS THE RETURN VALUE Down Below.
Notice how print is at the top of the content. I thought that the same might happen with includes too.
Forum: Fixing WordPress
In reply to: Form included via shortcode showing stray "1" below submit buttonHi Zoonini!
PHP’s include statement was successful and the file you are including most likely has no return value. When it’s output is stored in a variable, the value will be “1”. Please see php doc example 130 for a better explanation of this.
So, when you look at this code:
$inquiry = include('contact-form-sidebar.php');
Two things are happening:
- A file is being included which I assume contains html.
- The result of the include state,ent is stored in $inquiry.
When you return the value of $inquiry, WordPress will “inject” it into the post_content in place of the shortcode. Would be interesting to see what happens using this function with content both before and after the shortcode.
Hope this makes sense ??
Forum: Plugins
In reply to: [Taxonomy Images] No thickbox an "Associate with this term" not workingNot sure what this could be. I’ve tested in multiple browsers on XP and OS X and have never experienced this. Have you tried other user agents? Have you tried the plugin without others installed? Which other plugins do you have installed?
Forum: Plugins
In reply to: [Taxonomy Widget] Pretty URLs not working any moreThis has been uploaded to the official WordPress repo. Closing this ticket.
Forum: Plugins
In reply to: [Taxonomy Widget] No custom taxonomies to display?@dichtungsmittel Thanks for the bug report and sorry about introducing it ?? I did not test with taxonomies registered after init 0 which I probably should have. Version 0.6.1 will fix this issue without you having to modify your code. Please upgrade as there have been security fixes since 3.0 was originally released.
@nikasama83 Thanks for providing the quick fix for this! This was something that I could fix relatively easy in the plugin. It should not bother anyone else in the future.
Forum: Plugins
In reply to: [Taxonomy Widget] Current Category – Multiple Taxonomies – EnhancementFeel free to send me the code for this. I would love to check it out! Haven’t had the time to dive into such queries, but it’s really good to know how multiple term queries can be modified via url … I just updated this plugin and was wondering if that was possible.
This plugin is developed on Github https://github.com/mfields/taxonomy-widget if it’s easier to send a pull request.
Best,
-Mike