WordPress.org

Ready to get started?Download WordPress

Forums

Simple Links
[resolved] Show current category links only? (6 posts)

  1. maddogprod
    Member
    Posted 10 months ago #

    I've looked through the documentation and don't see what I'm trying to do. I want to put a shortcode in the sidebar that will display links for the current category of that page only. Seems like it should be simple....

    http://wordpress.org/plugins/simple-links/

  2. Mat Lipe
    Member
    Plugin Author

    Posted 10 months ago #

    HI maddogprod,

    Using
    [simple-links category="test"]
    Will display the links for a category named test.

    Otherwise if you are trying to pull the category from somewhere else you could use a
    echo do_shortcode('[simple-links category="test"]');
    and enter the category on fly from your theme's file.

    Hope this helps.

  3. maddogprod
    Member
    Posted 10 months ago #

    Thanks for the quick response. I'm trying to call the category on the fly along with the category page. Say I click a link that takes me to http://mysite.com/stories/category/f-257. I'd like to automatically display [simple-links category="f-257"]....I know this isn't correct, but since I'm using the slug, in effect something like [simple-links category="$slug"] so it would automatically use the current category slug of that page.

    I hope I'm making sense.

  4. Mat Lipe
    Member
    Plugin Author

    Posted 10 months ago #

    You could use something like

    $name = get_cat_name( get_query_var('cat');

    to get the name then run it like

    echo do_shortcode('[simple-links category="'.$name.'"]');

    Hope this helps.

  5. Mat Lipe
    Member
    Plugin Author

    Posted 10 months ago #

    I missed a ) in the above example. It should be

    $name = get_cat_name( get_query_var('cat'));

  6. maddogprod
    Member
    Posted 10 months ago #

    Thanks. I wanted to make sure variables would work within the shortcode so that (or a similar version) should do the trick. I'll let you know if I have any problems.

    Thanks again.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.