WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Taxonomy Images BETA] Not compatible with Reveal IDs for WP Admin (9 posts)

  1. kahi
    Member
    Posted 4 years ago #

    Hi, thanks for the plugin (wonderful idea!) but it seems to be not compatible with plugin Reveal IDs for WP Admin http://wordpress.org/extend/plugins/reveal-ids-for-wp-admin-25/.

    The second thing - could please you make the $settings variable public or provide a way to get the attachment-id linked to a specified taxonomy-term-id? (The do_action way relies it's in $wp_query which is not too flexible I think...) Thanks. Edit: I know I can get it via get_option('taxonomy_image_plugin') but that's not too nice, is it... :-)

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

  2. Michael Fields
    Themer
    Posted 4 years ago #

    kahi - Thanks for the feedback - I will look into the compatibility issue in the next couple of days. I have absolutely no problem with making the settings var public. I used the $wp_query in the action becuse it was the only way (that I could find) to get the term_taxonomy_id on all suported views. If you know a better way, I would love to know!

  3. kahi
    Member
    Posted 4 years ago #

    @mfields, I have absolutely no problem with reading term-id from $wp_query - I wanted to show (and with help of get_option() I did) images inside own cycle of categories (got by get_categories() which does not modify $wp_query), so I had to seek for other way than do_action().

    Basically, instead of:

    <?php
    $cat_to_att = get_option('taxonomy_image_plugin');
    $cats = get_categories(array(...));
    foreach ($cats as $c) { ?>
    
    	<a href="<?php echo get_category_link($c->term_id) ?>">
    		<?php if ($cat_to_att[$g->term_id]) echo wp_get_attachment_image($cat_to_att[$g->term_id], 'thumbnail'); ?>
        </a>
    <?php
    } ?>

    There would be nice possibility of:

    <?php
    $cats = get_categories(array(...));
    foreach ($cats as $c) { ?>
    
    	<a href="<?php echo get_category_link($c->term_id) ?>">
    		<?php if (YourPlugin::CatToAtt($c->term_id)) echo wp_get_attachment_image(YourPlugin::CatToAtt($c->term_id), 'thumbnail'); ?>
        </a>
    <?php
    } ?>

    Sorry for the verbose explanation, it probably wasn't necessary.

  4. Michael Fields
    Themer
    Posted 4 years ago #

    kahi,
    I was able to find a work around to a couple of bugs that I discovered in the Reveal IDs for WP Admin plugin. Thanks for the tip! It was a super easy fix.

    Please note that this plugin stores an array that use the $term->term_taxonomy_id as the key and the $post->ID of the attachment as it's value. Although $term->term_id will work in some cases, it can return a false positive where multiple taxonomies share the same name.

    I added a argument to get_image_html() and print_image_html() which will allow you to pass the term_taxonomy_id to specify which image you would like returned. You second example would look something like this:

    $cats = get_categories();
    foreach ( $cats as $c ) {
    	$url = get_category_link( $c->term_id );
    	$img = $taxonomy_images_plugin->get_image_html( 'medium', $c->term_taxonomy_id );
    	if( !empty( $img ) )
    		print '<a href="' . $url . '">' . $img . '</a>';
    }

    Before you upgrade to 0.3, MAKE SURE TO DELETE LINE 75:
    <?php do_action( 'taxonomy_image_plugin_print_image_html', 'detail' ); ?>

  5. kahi
    Member
    Posted 4 years ago #

    @mfields, thank you twice. :-)

  6. Michael Fields
    Themer
    Posted 4 years ago #

    No problem! Thanks for informing me of the incompatibility!

  7. wootowl
    Member
    Posted 3 years ago #

    This doesn't work for me:

    $cats = get_categories();
    				foreach ( $cats as $c ) {
    					$url = get_category_link( $c->term_id );
    					$img = $taxonomy_images_plugin->get_image_html( 'detail', $c->term_taxonomy_id );
    					if( !empty( $img ) )
    						print '<a href="' . $url . '">' . $img . '</a>';
    				}

    Error returned:

    Fatal error: Call to a member function get_image_html() on a non-object in /wp-content/themes/default/header.php on line 106

    Not sure what's going on here . . .

  8. Michael Fields
    Themer
    Posted 3 years ago #

    Try putting this line before the code you posted above:
    global $taxonomy_images_plugin;

  9. wootowl
    Member
    Posted 3 years ago #

    Try putting this line before the code you posted above:
    global $taxonomy_images_plugin;

    Works! Thanks :)

Topic Closed

This topic has been closed to new replies.

About this Topic