WordPress.org

Ready to get started?Download WordPress

Forums

Display category as link (8 posts)

  1. jumust
    Member
    Posted 1 year ago #

    Hi,
    I have

    <?php
                            if($title) {
                                                    echo $before_title.$title.$after_title;
                            }
                            ?>

    it's displaying the category name. How can I show the category link instead of only the name?

    Thx

  2. Edward Caissie
    Theme Review Admin
    Posted 1 year ago #

    The snippet of code you are showing really does not provide enough context. It looks to be from a plugin ... it may be useful to link to a http://pastebin.com of the code.

  3. jumust
    Member
    Posted 1 year ago #

    Yep you are right it's from a plugin that is part of the theme I'm using.

    Here it's the pastebin of the whole file http://pastebin.com/33njxvH2

    It has as output a widget to show the last recent posts of a category you can select within the widget itself

  4. jumust
    Member
    Posted 1 year ago #

    Do you think you need any other files?

    Just let me know which functions you are looking for and I will search it through files

    Thanks

  5. jumust
    Member
    Posted 1 year ago #

    Hey Edward Caissie Theme Review Admin,
    did you see my pastebin? Any solution?

  6. Edward Caissie
    Theme Review Admin
    Posted 1 year ago #

    @jumust - Sorry, I just saw you had replied.

    It appears the widget may accept multiple categories as part of its options. You will have to consider either insuring you only ever choose one category; or, write code to use a specific category (the easiest is the first category choice from the options field); then write the appropriate code to use your category choice as a link.

    Once you have sorted out the above simply wrap the $title in the category link anchor.

    Have a look at my 'BNS Featured Category' plugin for some ideas.

  7. jumust
    Member
    Posted 1 year ago #

    Thanks for your help!

    Here it is the widget, you can select one category, choose the title and number of posts shown, finally the thumbnail

    http://screencast.com/t/Gp5w17chrNU

    I can't handle what you suggested, too tricky for my knowledge. I don't want absolutely to use other plugin on my site because I have already a lot, but looks like this plugin will make the trick http://wordpress.org/extend/plugins/gg-widget-title-link/

  8. Edward Caissie
    Theme Review Admin
    Posted 1 year ago #

    Yes, that widget does look like it offers you a work-around for your issue.

Topic Closed

This topic has been closed to new replies.

About this Topic