The MU forums have moved to WordPress.org

A couple features for the Site Wide Tags plugin (5 posts)

  1. mikeboy3
    Member
    Posted 15 years ago #

    Greetings,
    This plugin is one that I have been waiting on for many months, it is great and I love it.
    I just got the Site Wide Tags plugin working and I know that only new posts or edited posts will be taken into account, so basically, this plugin would be complete if there was a way to automate the process of Editing and Saving the posts in order to publish them in the main blog.
    I am sure this is not a very big problem for an experienced WP coder and it is a feature that would really help the plugin's users.
    If there is a way to do this already, please tell me.

    And also, I want to know, is there a way to display the blog name or a short code before each post title? so that people can see the author's blog name when reading the main blog.

    Thank you!

  2. dsader
    Member
    Posted 15 years ago #

    I use the following in the postmeta section of The Loop in the tags blog template.

    $details = get_active_blog_for_user(get_the_author_id());
    echo '<a href="' . $details->siteurl . '">' . $details->blogname . '</a>';

  3. mikeboy3
    Member
    Posted 15 years ago #

    Well, I found an answer to the first problem:

    This should be run in the PHP section of the Powertools plugin.

    //For Donncha's Sitewide Tags plugin: Populate tags blog with all posts made before the plugin was added
    $posts = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_status = 'publish'" );
    if ( !empty($posts) ) {
        foreach ( $posts as $post ) {
            $post_id = $post['ID'];
            if($post_id != 1 && $post_id != 2)
                sitewide_tags_post($post_id, get_post($post_id));
        }
    }

    It didn't work, any deas?

    Edit: Thanks dsader, but what if the tags blog uses the same template as all the other blogs? will the blog name be displayed on all blogs?

  4. dsader
    Member
    Posted 15 years ago #

    mikeboy3, I use multiple copies of the same theme(Blue_home, Blue_2, Blue_tags, etc) and then use SiteAdmin->Blogs->Edit to assign themes to "special" blogs.

  5. colas.nahaboo
    Member
    Posted 15 years ago #

    This code is braindamaged.
    $post *is* an integer, the id. $post['ID'] is thus garbage, the net result is to only take the first 10 posts of each blog.
    The proper one is:

    $posts = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_status = 'publish'" );
    if ( !empty($posts) ) {
    foreach ( $posts as $post ) {
    if($post != 1 && $post != 2)
    sitewide_tags_post($post, get_post($post));
    }
    }

About this Topic

  • Started 15 years ago by mikeboy3
  • Latest reply from colas.nahaboo