WordPress.org

Ready to get started?Download WordPress

Forums

Taxonomy Images
Some suggestions (4 posts)

  1. jflagarde
    Member
    Posted 4 years ago #

    Hello,

    I've been playing a little bit with your wonderfull plugin. I plan to integrate it in a touristic website.

    I plan to use it in 2 ways:

    - In a category with subcategories, I show a list of all the sub-categories. For each of the sub-category, I want to show the "thumbnail" image, the title and the description of the sub-category.

    - In a post, just below the title of the post, I want to show a series of small icons (probably around 16x16 or 20x20) representing each selected element of a specific taxonomy.

    Here is the code I plan to use for both my projects:

    $taxonomy_name = 'name_of_the_taxonomy';
    $terms = get_terms($taxonomy_name);
    foreach ( $terms as $t ) {
    $url = get_term_link( $t, $t->taxonomy );
    $img = $taxonomy_images_plugin->get_image_html( 'detail', $t->term_taxonomy_id );
    if( !empty( $img ) )
    print '' . $img . '';
    }

    In the future, if you have the time, it would be great to have the possibility to change or add new image sizes.

    For the moment, since the detail size is too big for me, I solved my problem by simply changing the line "private $detail_size = array( 75, 75, true );" to "private $detail_size = array( 20, 20, true );" in taxonomy-images.php.

    Thank you again,

    http://wordpress.org/extend/plugins/taxonomy-images/

  2. jflagarde
    Member
    Posted 4 years ago #

    sorry...

    $terms = wp_get_object_terms($post->ID,$taxonomy_name);
    instead of
    $terms = get_terms($taxonomy_name);

  3. Michael Fields
    Themer
    Plugin Author

    Posted 4 years ago #

    In the future, if you have the time, it would be great to have the possibility to change or add new image sizes.

    This is actually out of the scope of this plugin. WordPress makes it easy to create new image sizes. I would strongly suggest doing this in a custom plugin. I always create a custom plugin that stores non-theme dependent customizations (taxonomies, post_types, image sizes, etc.). The code is as easy as it gets:

    add_action( 'init', 'mysite_custom', 4 );
    function mysite_custom() {
       add_image_size( 'name_for_the_image_size', 20, 20, true );
    }

    the fourth parameter can be either true or false depending on whether you want it to be cropped.

    Hope this helps,
    -Mike

  4. jflagarde
    Member
    Posted 3 years ago #

    Hello Michael,

    Thanks for the reply.

    I reprogrammed all my sites recently using custom plugins and a more versatile parent/child theme using hooks.

    I realised that it is simplier to add a custom field "image url" directly in the taxonomy (at least with wordpress 3). Also, it allows me to have a better file url to optimize SEO.

    With the code you mentionned above, I'm able to create a small icon to represent each term of my taxonomy. Thanks a lot again!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic