WordPress.org

Ready to get started?Download WordPress

Forums

Category Images Hack (10 posts)

  1. NuclearMoose
    Member
    Posted 10 years ago #

    Thanks for doing this, Matt. I think lots of people will put it to good use.

  2. pieceoplastic
    Member
    Posted 10 years ago #

    great stuff! but for some unexplainable reason i cant seem to get it to work ....
    i did it exactly as it says in the instructions. many times over!
    i even tried changing my image files into png files and to put them into the proposed folder, but it keeps feeding me back a broken image tag.
    would it be possible to use the category number instead of the name somehow?
    because i suspect there lays my problem: the nice names... hmmm

  3. Matt Mullenweg
    Troublemaker
    Posted 10 years ago #

    You can use the category ID by changing:
    <img src='$image_directory/$category->category_nicename.$image_type
    to
    <img src='$image_directory/$category->category_id.$image_type

  4. pieceoplastic
    Member
    Posted 10 years ago #

    i still get the same problem.
    this is what i did: i replaced the tag as you mentioned in the my-hacks.php file. i renamed my icons 1.png 2.png 12.png corresponding to the category_id. i then went ahead and inserted the <?php category_images(' '); ?> inside the loop in my index.php.
    when i load the page i receive a broken image.
    any further pointers? what could i be doing wrong here? is this working for someone else?

  5. Matt Mullenweg
    Troublemaker
    Posted 10 years ago #

    Why don't you copy and paste the HTML it's giving you or point us to your page.

  6. MathiasBynens
    Member
    Posted 10 years ago #

    This is awesome! Is there a similar script to show User Images depending on the poster?

  7. TonyBierman
    Member
    Posted 10 years ago #

    Can anyone point me to a demo site that's using this hack? I'd like to see what it look like prior to installing.
    Thanks,
    Tony

  8. pieceoplastic
    Member
    Posted 10 years ago #

    @ allusion: i guess that was kind of simple. i took out the leading / in the path to directory tag in my-hacks.php
    like so: $image_directory = 'wp-images/'
    and now it seems to be able to retrieve the icons!
    woo! and thanx so much, dude!
    @ tonyBiermann: the url to my website is:
    http://www.web-laun.ch/pieceoBlog/indexTxt.php

  9. flakkito
    Member
    Posted 10 years ago #

    Hi, i am trying to implement this and I know this will make everyon roll their eyes, but:
    i am getting a parse error in the second line [$categories = get_the_category();]
    function category_images($seperator = '', $image_type = 'png',$image_directory = '/wp-images/') {
        $categories = get_the_category();
            $image_directory = preg_replace('|/+$|', '', $image_directory);
       
    I copied and pasted it from the wiki- hack file is enabled.
    Can someone tell me if this is related to DB error?
    Is it something else? I've had similiar results with a lot of the hacks.
    By the way, im runnung 1.1 beta
    thanks
    :)

  10. flakkito
    Member
    Posted 10 years ago #

    Scratch that- I was copying and pasting from safari- tried it in firefox and it worked. something to do with whitespace maybe.
    :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.