Specific category link in sidebar

Discussion in 'WordPress' started by deluxdon, Sep 9, 2012.

  1. #1
    How to add link in sidebar under specific category (display only for that category) ?

    Can anyone share code for that ??

    Thanks in advance for that.

    DON.
     
    deluxdon, Sep 9, 2012 IP
  2. Nigel Lew

    Nigel Lew Notable Member

    Messages:
    4,642
    Likes Received:
    406
    Best Answers:
    21
    Trophy Points:
    295
    #2
    Do you mean something like
    Category 1
    random link
    Category2
    Category3 ??

    Nigel
     
    Nigel Lew, Sep 9, 2012 IP
  3. deluxdon

    deluxdon Catch Me If You Can...!!!™ Staff

    Messages:
    25,481
    Likes Received:
    1,943
    Best Answers:
    32
    Trophy Points:
    480
    #3
    I want to add one link in a sidebar which appear only in that specific category (not any other pages as well as categories).

    DON.
     
    deluxdon, Sep 9, 2012 IP
  4. dcristo

    dcristo Illustrious Member

    Messages:
    19,776
    Likes Received:
    1,200
    Best Answers:
    7
    Trophy Points:
    470
    Articles:
    7
    #4
    Check if there is a plugin, you can't do this by default.
     
    dcristo, Sep 9, 2012 IP
  5. Nigel Lew

    Nigel Lew Notable Member

    Messages:
    4,642
    Likes Received:
    406
    Best Answers:
    21
    Trophy Points:
    295
    #5
    My logic may be flawed here but....

    create a menu that you will not use, using the wp menu system that includes the link in question?

    Then, add said link to the category tree much like you would add say home where you type a custom URL.

    Then use "my category order" widget perhaps and use the widget logic plugin so it only appears on that category page?

    Not real elegant I know lol... Not sure that is entirely helpful as it won't be styled per say or stand out or be indented for instance but that should at least get it in there.

    That is a tricky one. I will think it over.

    You may want to ask this on stackoverflow.com
    Nigel
     
    Nigel Lew, Sep 9, 2012 IP
  6. deluxdon

    deluxdon Catch Me If You Can...!!!™ Staff

    Messages:
    25,481
    Likes Received:
    1,943
    Best Answers:
    32
    Trophy Points:
    480
    #6
    Thanks both of you.

    @Nigel - Category is already there since long time :(

    @dcristo - I am sure that code related to that exist but not remember as of now. Someone know that and share here for sure. Waiting.. ;)

    DON.
     
    deluxdon, Sep 9, 2012 IP
  7. Devtard

    Devtard Notable Member

    Messages:
    850
    Likes Received:
    133
    Best Answers:
    4
    Trophy Points:
    220
    #7
    Devtard, Sep 9, 2012 IP
  8. raoraj

    raoraj Well-Known Member

    Messages:
    849
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    110
    #8
    raoraj, Sep 9, 2012 IP
  9. deluxdon

    deluxdon Catch Me If You Can...!!!™ Staff

    Messages:
    25,481
    Likes Received:
    1,943
    Best Answers:
    32
    Trophy Points:
    480
    #9
    Thanks a lot. Your given link helped me a lot. Though i need to alter it little bit to work properly.

    DON.
     
    deluxdon, Sep 10, 2012 IP
  10. Devtard

    Devtard Notable Member

    Messages:
    850
    Likes Received:
    133
    Best Answers:
    4
    Trophy Points:
    220
    #10
    No problem. You can also use the function wp_get_post_categories to retrieve a list of categories if you want to show the link also when a post assigned to a specific category (categories) is being displayed.
     
    Devtard, Sep 10, 2012 IP
    deluxdon likes this.
  11. deluxdon

    deluxdon Catch Me If You Can...!!!™ Staff

    Messages:
    25,481
    Likes Received:
    1,943
    Best Answers:
    32
    Trophy Points:
    480
    #11
    Thanks for this but issue already sorted out using your given earlier link :)

    DON.
     
    deluxdon, Sep 10, 2012 IP