global tags feed in a widget (like global posts) maybe edit global posts widget

I would like posts only with a specific tag to stream down the main page showing in the same form (with avatar) as the Global Posts Widget. I have my Global Tags Feed working perfectly- its just that bare RSS is rough looking and the Global Posts Widget displays the feed with avatar and author beautifully.

I was thinking the easiest way would be to edit the global posts widget to make it pull its feed from the Global Tags Feed. How can I do this?

Thanks so much guys! I value your site and your support greatly.

JDP

  • Andrew
    • Champion of Loops

    Hiya,

    You need to edit the recent global posts widget and modify the query on line 158. Replace this bit of the query:

    site_posts ORDER

    with this:

    site_posts WHERE post_terms LIKE ‘%|TAG_ID|%’ ORDER

    Replace TAG_ID with the ID of the tag you want to pull. Ex:

    site_posts WHERE post_terms LIKE ‘%|102|%’ ORDER

    Thanks,

    Andrew

  • -
    • New Recruit

    Andrew I love you man!!! :slight_smile: THIS s so great I am so excited!!! IT WORKS Beautifully!

    If I wanted to have 2 different widgets that are each pulling a different tag on the mainpage how would I work that.

    I tried duplicating the widget file, renaming the new one as widget-learning.php and it made the whole site white.

    What other changes should I make if I wanted to duplicate the global posts widget- so that I have 2 global posts widget each pulling a different tag.

    Thanks so much for your earlier reply!!!

    Jon

  • Andrew
    • Champion of Loops

    If I wanted to have 2 different widgets that are each pulling a different tag on the mainpage how do I do that?

    I’m afraid you can’t have two instances of this widget. You’d have to duplicate the widget changing the widget details and function names to prevent a collision.

    Thanks,

    Andrew

  • -
    • New Recruit

    Thanks! I am having problems trying to create 2 widgets.

    This is what I did:

    Downloaded a copy of the original widget (widget-recent-global-posts.php) to my computer.

    Renamed that widget (widget-recent-learning.php) then edited it to do a search/replace of

    “widget-recent-global-posts” to “widget-recent-learning”.

    Uploaded the new file (widget-recent-learning.php) to my /mu-plugins folder

    This is not working… any help to get this to work would be so much appreciated.

    J

  • -
    • New Recruit

    Oh man! I figured it out- no custom coding. After I renamed the original file to widget-recent-learning.php

    I did a global search replace of “widget-recent-global-posts” to “widget-recent-learning”.

    Then did a global search replace of ” Recent Global Posts” to “Recent Learning”.

    I was wondering why you said it required custom coding? It almost made me give up because you made it seem like a difficult task.

    Thanks so much again for the previous help- I would have never even gotten to this point without your help originally.

    J