WordPress.org

Support

Support » Plugins and Hacks » BNS Featured Category » [Resolved] [Plugin: BNS Featured Category] How to make header title as link to category?

[Resolved] [Plugin: BNS Featured Category] How to make header title as link to category?

Viewing 4 replies - 1 through 4 (of 4 total)
  • First off, make a back-up of the plugin … just in case.

    Next, you will be looking at this line of code:
    echo $before_title . '<span class="bnsfc-cat-class-' . $cat_choice_class . '">' . $title . '</span>' . $after_title;

    The key is the $title which will need to be wrapped in an <a href=> construct along the lines of:
    <a href="<?php get_category_link( $cat_choice ); ?>">$title</a>

    The above is untested (and the reason I recommended the backup first); it will likely cause a 404 result if more than one category is used in the widget instance; and, will be over-written when version 2.0 of the plugin is released in the near future. Also to note, the entire code line will need to be re-written as the echo will no longer produce the correct results.

    I do like the idea, and will make a note to review it further for possible inclusion in future releases of the plugin, in the meantime keep track of your changes in case it is not included.

    Thank for replying! Now the title is as link but the link in itself doesn’t work.

    echo $before_title . ‘<span class=”bnsfc-cat-class-‘ . $cat_choice_class . ‘”>“>’ . $title . ‘</span>’ . $after_title;
    }

    Am I missing something?

    Now the link goes to: mysite.com/<?php%20get_category_link(%20$cat_choice%20);%20?>

    Use this code as a replacement of the original echo line:

    echo $before_title . '<span class="bnsfc-cat-class-' . $cat_choice_class . '"><a href="' . get_category_link( $cat_choice ) . '">' . $title . '</a></span>' . $after_title;

    Again, the same conditions apply but this was quickly tested in a local environment and appears to work at first glance.

    Ok, thank, fixed!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] [Plugin: BNS Featured Category] How to make header title as link to category?’ is closed to new replies.
Skip to toolbar