• coxie

    (@coxie)


    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.

    https://thefootballguru.co.uk

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator t-p

    (@t-p)

    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.

    vtxyzzy

    (@vtxyzzy)

    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;
    Thread Starter coxie

    (@coxie)

    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

    Moderator t-p

    (@t-p)

    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.

    vtxyzzy

    (@vtxyzzy)

    @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.

    Thread Starter coxie

    (@coxie)

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

    vtxyzzy

    (@vtxyzzy)

    You got the right address. Check your email.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Can this be done’ is closed to new replies.