Support

Account

Home Forums General Issues Category Links

Solving

Category Links

  • I’m having trouble wrapping my head around how to link images to categories (slugs). The goal is to create a page with category images. I’ve searched the documentation and forums, but couldn’t find exactly what I was looking for, unless I missed it? If you know where I can find the documentation, would appreciate a link to the page.

    I’ve tried messing with the Taxonomy Field (along with the Image field), but couldn’t get that to work as a link (image would link to a number, but it didn’t go anywhere).

    So I went back to trying the WYSIWYG field and was going to try linking using the Image Alt somehow, but I can’t figure out how to do that. I just need to make this as simple as possible for the client to use, and still give them the control to keep them organized the way they want to.

    I’m open to ideas of course. Help??

    • Elliot

    • July 26, 2013 at 3:46 pm

    Hi @treebeard

    The easiest way to do this is to create a field group which contains the image field, and use the location rules to attach this field group to the taxonomy you want.

    Now when you edit the taxonomy term you will be able to add an image. Thus associating an image with each term (cagtegory).

    A page that shows all the taxonomies? That sounds like a taxonomy archive page and you can read about these on google / wp.org

  • I’m sorry, I have no idea what you’re trying to tell me LOL!

    Does anyone have an answer to this one yet? It’s probably something simple, but I have no idea to go about it because there is no documentation for this particular thing here, no example code, nothing. I just need to know what code and what fields to use and I don’t have time for reading tutorials on the internet, I’m kind of on a tight schedule. If there was documentation for this stuff on this site, I wouldn’t be asking in the forums 😉

    Help Please?

    thanks..

  • Sorry, let me paste what I wrote up there:

    “there is no documentation for this particular thing here, no example code”

    What I mean is there’s no documentation for what I’m trying to accomplish. I did review the documentation that is available and tried using that to create a link to the category, as I mentioned in my original post:

    “I’ve tried messing with the Taxonomy Field (along with the Image field), but couldn’t get that to work as a link (image would link to a number, but it didn’t go anywhere).”

    • Elliot

    • July 30, 2013 at 12:43 pm

    Hi @treebeard

    No worries.

    You need to break your task up into easy to tackle stages.

    1. Create a field group for the taxonomy, and add an image field.

    2. Edit your taxonomies and add the image data for each

    3. Create a custom page template an give it a name such as ‘Taxonomy Thumbnails’

    4. Create a page in the CMS and use this page template. View the page to see a blank white screen.

    5. Search on WP how to get all the taxonomy terms and loop through them. There is lots of documentation for this on the web.

    6. Finally, within the taxonomy loop, use the term_id to load in the ACF image data and render the image!

    7. Pop open a beer!

  • Thanks.

    What I’m having trouble with is the code to use. ACF code.

    Here’s what I tried that’s not working:

    <?php if ( get_post_meta($post->ID, 'my_image', true) ) : ?>
    <a href="<?php if ( get_post_meta($post->ID, 'my_image_link', true) ) : ?>"><img src="<?php the_field('my_image'); ?>" /></a>
    <?php endif; ?>

    This is what I’m having trouble with. When I add the ACF code to load the Taxonomy (which should be converted to a link, since the ACF Link field isn’t working for some reason) I’m not getting a real link, I’m getting a link to a number that goes nowhere.

    • Elliot

    • July 30, 2013 at 1:13 pm

    Hi @treebeard

    Sorry mate. Your code contains too make syntax and PHP errors for me to help on this one.

    I would advise you to read over the documentation for the image field to find out how it works.

    1. Use get_field
    2. Address the if statement inside your img src
    3. Correct the field names
    4. Correct the field return types
    5. Your code has no reference to anything taxonomy related

  • Kind of my point really, I’m not a programmer. I design custom templates, but I don’t do any custom coding. If there’s no example, I’m at a loss.

    oh well, I’m sure there’s someone out there that knows how to code php and uses ACF, I’ll check wp forums. Thanks anyway.

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.