WordPress.org

Ready to get started?Download WordPress

Forums

Taxonomy Images
Call to a member function get_image_html() on a non-object (5 posts)

  1. elDeuce
    Member
    Posted 3 years ago #

    I am trying to add the image to a concatenation via
    $content .= $taxonomy_images_plugin->get_image_html( 'fullsize' );

    But I am getting

    Fatal error: Call to a member function get_image_html() on a non-object

    The image is going to show a single category page... Any ideas?

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

  2. elDeuce
    Member
    Posted 3 years ago #

    Edit:
    It still fails, even if I hardcore a category ID into it.

    $content .= $taxonomy_images_plugin->get_image_html( 'fullsize', 4 );

  3. Michael Fields
    Themer
    Plugin Author

    Posted 3 years ago #

    Try this at the top of your theme file:

    global $taxonomy_images_plugin;

  4. jflagarde
    Member
    Posted 3 years ago #

    Hello mfields,

    I have the same problem on my test site. I use the Theme "Hybrid Structure" (child theme of Hybrid).
    http://themehybrid.com/themes/structure

    It does work perfectly when I add the code in "post.php" in the parent theme directory (without the global declaration). However, it doesn't work when I add it in "function.php" of the child theme, even if I add the global declaration at the top of "function.php".

    I'm not really good in php programming, maybe I missed something concerning global variable declaration?

    Thank you so much for your great plugin! Even in beta version, it answered many of my needs and simplified a lot my work.

  5. Michael Fields
    Themer
    Plugin Author

    Posted 3 years ago #

    However, it doesn't work when I add it in "function.php" of the child theme, even if I add the global declaration at the top of "function.php"

    Are you using the object in a function? if so, you will need to declare it as global inside the function's definition like:

    <?php
    function my_function(){
       global $taxonomy_images_plugin;
       /* Other stuff */
    }

    Hope this helps,
    -Mike

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic