Support » Plugin: WordPress MU Sitewide Tags Pages » Blog titles with links

  • Resolved Tomas


    Awesome plugin!
    Just wonder if there’s an easy way to print out the blog title each post is fetched from in the theme for the global blog.

    Like entry meta:

    <div class=”entry-meta”>
    <?php the_time( ‘l F j, Y H:i’ ) ?> // From blog: <the source blog title here>

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author Ron Rennick


    MultiSite Guru

    You would need to write something for that. SWT doesn’t pass that info through to the global blog.

    Thanks Ron, I came to that conclusion aswell.

    The post_meta table on the global blog only contains the blogid and permalink for each post so I’d probably need to customize the plugin which is just a little above my php knowledge 😉

    I had a similar need, I wound up editing the SWT plugin to grab the title in the global_meta array. I’m still working on a way to do it without modifying the plugin but until then, this might help.

    Around line 367 of the SWT plugin I added $global_meta['blogtitle'] = get_bloginfo('title');

    and then where ever you want to output the title on your tags site echo (get_post_meta($post->ID, "blogtitle", true));

    miklb, this is fabulous info.
    Will have a try out later today

    Many many thanks!

    hmm, I’m not getting the expected output?!
    Instead of the blog title from the corresponding blog I get the global blog title on each post.
    miklb, would you consider sharing your modified plugin?


    My version literally is the same plugin with that one line added. Can you confirm that the posts pushed to your tags blog is getting that post_meta field added with the the site title associated with the post?

    I’m not outputting the title in template, rather I’m creating a custom feed where I use the post_meta. If you can confirm the correct title is being added, I’ll double check how I’m outputting the info.

    Plugin Author Ron Rennick


    MultiSite Guru

    @miklb – there was quite a bit of rewriting in the latest version, so your line # might be off enough to be in the wrong place.

    @miklb – I get the blogtitle value in the post_meta now but it’s always the global blog title and not the corresponding blog title.

    Maybe I put your code in the wrong place?
    From the plugin line 367:

    switch_to_blog( $tags_blog_id );
                    $global_meta['blogtitle'] = get_bloginfo('title');
            if( is_array( $cats ) && !empty( $cats ) ) {
                    foreach( $cats as $t => $d ) {
                            /* Here is where we insert the category */
                            wp_insert_category( array('cat_name' => $d['name'], 'category_description' => $d['name'], 'category_nicename' => $d['slug'], 'category_parent' => '') );
                            /* Now get the category ID to be used for the post */
                            $category_id[] = $wpdb->get_var( "SELECT term_id FROM " . $wpdb->get_blog_prefix( $tags_blog_id ) . "terms WHERE slug = '" . $d['slug'] . "'" );
            $global_post = $wpdb->get_row( "SELECT * FROM {$wpdb->posts} WHERE guid = '{$post->guid}'" );
            if( $post->post_status != 'publish' && is_object( $global_post ) ) {
                    wp_delete_post( $global_post->ID );
            } else {
                    if( $global_post->ID != '' ) {
                            $post->ID = $global_post->ID; // editing an old post

    Plugin Author Ron Rennick


    MultiSite Guru

    Move the line you added to before the switch_to_blog( ...

    Thanks Ron but sorry…no dice.
    Still same global blog title output on each post.

    Maybe I’m doing the loop wrong?
    In the theme file loop I have it like this (twentyten standard):

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Opps, looks like it’s actually working now (had a cache issue)

    Thank you both for your help 🙂

    cool, sorry I didn’t get back sooner. And thanks Ron on the heads up of the rewriting, I was working off a dev version still.

    For future reference, for v.4.1.1 I added that after line 368 $global_meta['blogid'] = $org_blog_id = $wpdb->blogid; // org_blog_id

    Thanks for your input

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Blog titles with links’ is closed to new replies.