Support » Fixing WordPress » Display URL of 1 certain category when each post has 2

  • Hi, I think I found in the codex something very close to what I’m trying to do, but it’s a little tricky because every post on my site has been assigned 2 categories, instead of 1.

    It’s a guitar tab site, so each post is categorized by tab type and album. For example, the tab for this song is in both the “Guitar Tabs” (tab type) and “Dark Side of the Moon” (album) categories.

    In this case, I just want to display the album category link, which is http://www.pinkfloydtabs.com/the-dark-side-of-the-moon

    I’m pretty sure in order to do this I should do a combination of “get_category_link” & exclude the guitar tab ID category, but I’m not quite sure.

    Maybe something like “get_category_link(exclude=19)” with 19 being the Guitar Tabs (tab type) category that I don’t want to display.

    Any ideas?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter Floyd3

    (@floyd3)

    I’ll explain exactly what I’m trying to do, as simply as possible.

    Please see the example post here: http://www.pinkfloydtabs.com/breathe-guitar-tab

    I just want to make the image under “Album Cover from This Song” clickable, to the album category each post is in.

    So for this example, that pic would link to http://www.pinkfloydtabs.com/the-dark-side-of-the-moon – which is the URL to 1 of it’s 2 already assigned categories.

    The other category this post is in, is: http://www.pinkfloydtabs.com/guitar-tabs (the tab type category) and I don’t want to link to that 1.

    Thread Starter Floyd3

    (@floyd3)

    I’m imagining the link would something very close to this:

    <?php $category_link = get_category_link($category_id&exclude=19 ); ?>
    <a href="<?php echo esc_url( $category_link ); ?>">
    <img src="http://www.pinkfloydtabs.com/dark-side-of-the-moon.jpg"></a>

    But that doesn’t quite work. Looking for a little guidance. Searched the forums and codex and couldn’t find the answer. I think that code is very close to being right.

    Thread Starter Floyd3

    (@floyd3)

    I still can’t figure this out – doesn’t seem like it should be too hard… Anyone?

    Thread Starter Floyd3

    (@floyd3)

    If nobody knows the answer, can someone tell me what other options I have besides posting here?

    I’ve searched Google, the WP Codex, these forums, tried many different codes myself and I’m still stumped.

    Not sure where else to turn but there. Are there any other WordPress support options or forums?

    Thread Starter Floyd3

    (@floyd3)

    What do people do if they can’t find help here?

    Thread Starter Floyd3

    (@floyd3)

    I take it if no one responds maybe there isn’t a way for this to be done in the first place? Are there some things that aren’t documented in the codex?

    Thread Starter Floyd3

    (@floyd3)

    Still confused, hoping someone sees this

    Thread Starter Floyd3

    (@floyd3)

    I’ll try again in a few days. Now I’m going for the record now of how many days, and responses in a row I can go before someone responds. 😛

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Display URL of 1 certain category when each post has 2’ is closed to new replies.