The MU forums have moved to WordPress.org

Site Wide Tag Solution (10 posts)

  1. adarii
    Member
    Posted 16 years ago #

    Hey Gang

    After a day of headaches, I've made some changes to the "ah-recent-posts-mu" plugin that looks for a specific tag (not category tho that could be changed I'm sure) and only pulls the most recent post with that tag.

    *** WARNING****

    I am a hack, my sql / php knowlege is all self taught and very very very sketchy and basic, I'm sure there is a better way of doing this but I don't know it. If you do, feel free to tidy it up and make it nice for the rest of us :)

    I've modified the statement: $thispost = $wpdb->get_results () to look like this:

    SELECT post_title, guid, post_content, post_date, user_login, $blogTaxonomyTable.term_taxonomy_id, $blogTaxonomyTable.term_id, taxonomy, $blogRelationshipsTable.term_taxonomy_id, $blogTermsTable.term_id, taxonomy, object_id, name, $blogPostsTable.ID

    FROM $blogPostsTable, wp_users, $blogTaxonomyTable, $blogRelationshipsTable, $blogTermsTable

    WHERE wp_users.ID = $blogPostsTable.post_author

    AND $blogTermsTable.name = '***' *** Insert your tag name here ***

    AND post_status = 'publish'
    AND taxonomy = 'post_tag'
    AND post_type = 'post'
    AND $blogPostsTable.ID = object_id
    AND $blogTermsTable.term_id = $blogTaxonomyTable.term_id
    AND $blogTaxonomyTable.term_taxonomy_id = $blogRelationshipsTable.term_taxonomy_id
    AND post_date >= DATE_SUB( CURRENT_DATE( ) , INTERVAL 5 DAY )
    ORDER BY $blogPostsTable.id DESC

    Hope this is helpful to others

    Edit: Oh I should mention I have only used this on WPMU1.3

  2. adarii
    Member
    Posted 16 years ago #

    Oops I forgot it's actually not the default ah-recent-posts plugin but a mod that is floating around the forums. I can post my full changes if there's somewhere appropriate to put it.

  3. Konstan
    Member
    Posted 16 years ago #

    So this works but only 1 tag?

    You can put the whole file in a .txt file and upload it to your server, thats what most people do here to share some code.

  4. andrea_r
    Moderator
    Posted 16 years ago #

    Or you can upload it to wpmudev.org

  5. dbUNIT16
    Member
    Posted 16 years ago #

    Can anyone verify that this is working? I am desperately searching for a Site Wide Tags and Site Wide Categories solution that works with the latest MU release!

  6. adarii
    Member
    Posted 16 years ago #

  7. lunabyte
    Member
    Posted 16 years ago #

    Looks like it's going to eat a lot of resources. Glad I wrote my own system instead.

  8. adarii
    Member
    Posted 16 years ago #

    Care to share? :) I am just stumbling along by experimentation and hope. If someone has a better solution I'd love to see it and use it!

  9. demonicume
    Member
    Posted 16 years ago #

    wow. just wow. real classy.

  10. lunabyte
    Member
    Posted 16 years ago #

    I wasn't trying to be cocky, really, just expressing my happiness that I won't have to worry about the 1.3 update jacking things up.

About this Topic