Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #5210

    Hi guys!

    First of all, thanks for this georgous theme ;)

    I want to add a “Read More” button at the bottom of each Latest News widget, I found the php code of it in the class-framework-widgets.php and added that code in the right place :

    echo a href=”?cat=.$cat[0].”Read More;

    However, when I click on this new button, I want to redirect to the page of the category of the widget. My question is :

    How to pick the page of the category of the displayed widget ?

    I don’t know if I’m clear ^^ I can give an example if I’m not :)

    Thanks!

    #49255

    Hey,

    imho the easiest solution would be to set a global variable which contains some query information (i.e. the category). You can add following code in header.php:

    <?php
    global $wp_query, $cat_ID;

    if(is_category() || is_single()){
    $cat_ID = get_query_var('cat');
    }
    ?>

    and in the widget code use:

    <?php
    global $cat_ID;
    get_category_link( $cat_ID );
    ?>

    to get the current category link.

    #49256

    Hello,

    I would like to do this on my site as well, but am a little confused as to where to put the coding. I have the upScale theme installed and would like to have a “Read More” link at the bottom of my Latest News widget that links to the category blogroll. Where and how exactly do I do that?

    Thanks for the help!

    #49257

    Hi,

    It has been five days since my post and I would really like some help in getting this widget worked out. I just need some clarification on what code to use and where in order to get a “Read More” button at the bottom of the Latest News widget. I would like for the button to link to a list of all articles written under that category. I think the above code can help but everything I have tried seems to have no effect.

    Thank you for your time and help!

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

The topic ‘Creating a "Read More" button for the Latest News widget’ is closed to new replies.