WordPress.org

Ready to get started?Download WordPress

Forums

Can this be done (8 posts)

  1. coxie
    Member
    Posted 3 years ago #

    Ok so i run a football blog, i love WP and don't want to change it, i have a catagory page set up for each club, is there anyway with coding or something I can set up a widget that is displayed on each club page that only shows their recent news and not the recent news of all the clubs? say for instance manchester united, i'd like the man utd page to have a widget that just shows man utd news if you catch my drift.

    http://thefootballguru.co.uk

  2. Tara
    Member
    Posted 3 years ago #

    I don't know of a specific plugin for your intended use.
    Check these plugins if (there may be more) any will do what you intend to do.

  3. vtxyzzy
    Member
    Posted 3 years ago #

    You can use a text widget with a shortcode that checks the category and gets the correct post.

    To get shortcodes to work in widgets, add this to functions.php:

    add_filter('widget_text','do_shortcode');

    In the function that your shortcode calls, use something like this:

    $output = '';
    $cat = get_query_var('cat');
    if (intval($cat)) {
       // Use the cat id in $cat to get the post and format into $output
    }
    return $output;
  4. coxie
    Member
    Posted 3 years ago #

    that sounds good vtxyzzy the only trouble is im a bit of an old dumb fart when it comes to the usage of codes lol

  5. Tara
    Member
    Posted 3 years ago #

    vtxyzzy has provided superb solution!

    add_filter('widget_text','do_shortcode');

    that goes in your current theme's functions.php after the <?php tag

    the shortcode i believe goes in your page.

    the only trouble is im a bit of an old dumb fart when it comes to the usage of codes lol

    That's when a plugin comes in handy, provided you can find one that will do exactly what you want it do.

    But I will go for vtxyzzy's solution, which is excellent indeed. Just play with it, I am sure you can get to work. Just make sure to backup everything in case.

  6. vtxyzzy
    Member
    Posted 3 years ago #

    @coxie, since I am a bit of an old fart myself, I will be glad to help. Just email me at mac =at= mcdspot =dot= com and I will try to provide some code for you to copy.

  7. coxie
    Member
    Posted 3 years ago #

    cheers vtx I have sent one and thanks t-p for the response also.

  8. vtxyzzy
    Member
    Posted 3 years ago #

    You got the right address. Check your email.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.