• Resolved RG1527

    (@rg1527)


    Im using 2 different plugins (neither of which are getting any real support) but i believe that you fine folks might be able to give me a hand.

    I am using the co-authors plus plugin and the multisite global search plugin.

    I cant seem to wrap my heard around trying to pull in co-authors into the global search results.

    global search is pulling the author details like this:

    $blogid = '';
    	            foreach( $search as $s ) {
    	                $author = get_userdata( $s->post_author );
    	                if( $blogid != $s->blog_id ) {
    	                    $blogid = $s->blog_id; ?>

    And the author information is created with this
    <span class="globalsearch_author"><?php echo '<a href="https://' . $s->domain.$s->path.'author/'.$author->user_nicename . '" title="' . $author->user_nicename . '">' . $author->user_nicename . '</a>'; ?></span>

Viewing 5 replies - 1 through 5 (of 5 total)
  • neotechnomad

    (@neotechnomad)

    Thread Starter RG1527

    (@rg1527)

    Thanks but i had already found that thread and it did not work (is returning my nicename on every post instead of co-author)

    I have used this on several other sites and have not had any trouble getting it to work properly, but with the way the global search is pulling in the author I just cannot get it to work at all.

    neotechnomad

    (@neotechnomad)

    Is this the entire code…

    $blogid = '';
    	            foreach( $search as $s ) {
    	                $author = get_userdata( $s->post_author );
    	                if( $blogid != $s->blog_id ) {
    	                    $blogid = $s->blog_id; ?>

    …as it looks like you are missing two closing “}”.

    Thread Starter RG1527

    (@rg1527)

    i just omitted it in my paste up here is the full code

    <?php
    	            $blogid = '';
    	            foreach( $search as $s ) {
    	                $author = get_userdata( $s->post_author );
    	                if( $blogid != $s->blog_id ) {
    	                    $blogid = $s->blog_id; ?>
    
    	                    <h2 class='globalblog_title'><?php echo get_blog_option( $blogid, 'blogname' ) ?></h2>
    	                <?php
    	                } ?>
    
    	                <div <?php post_class( 'globalsearch_post' ) ?>>
    	                	<div class="globalsearch_header">
    	                    	<h2 id="post-<?php echo $s->ID.$s->blog_id; ?>" class="globalsearch_title"><a href="<?php echo get_blog_permalink( $s->blog_id, $s->ID ); ?>" rel="bookmark" title="<?php echo __( 'Permanent Link to', 'ms-global-search' ).' '.$s->post_title; ?>"><?php echo $s->post_title ?></a></h2>
    	                    	<p class="globalsearch_meta">
    								<span class="globalsearch_comment"><?php ms_global_search_get_comments_link( $s ); ?></span>
    								<span class="globalsearch_date"><?php echo date( __( 'j/m/y, G:i', 'ms-global-search' ) ,strtotime( $s->post_date ) ); ?></span>
    								<span class="globalsearch_author"><?php echo '<a href="https://' . $s->domain.$s->path.'author/'.$author->user_nicename . '" title="' . $author->user_nicename . '">' . $author->user_nicename . '</a>'; ?></span>
    								<?php echo ms_global_search_get_edit_link( $s, '<span class="globalsearch_edit">', '</span>' ); ?>
    							</p>
    						</div>
    
    						<div class="globalsearch_content">
    	                    	<div class="entry">
    	                    		<?php
    	                    		if(strcmp($excerpt, "yes") == 0)
    	                    			echo ms_global_search_get_the_excerpt( $s );
    	                        	else
    	                        		echo ms_global_search_get_the_content( $s ); ?>
    	                    	</div>
    						</div>
    	                </div>
    	            <?php
    	            }
    	        }
    	    } else { ?>
    		    <h3 class='globalpage_title center'><?php _e( "Not found", 'ms-global-search' ) ?></h3>
    	        <p class='globalpage_message center'><?php _e( "Sorry, but you are looking for something that isn't here.", 'ms-global-search' ) ?></p>
    	    <?php
    	    }
    	}
    }
    Thread Starter RG1527

    (@rg1527)

    As it turns out…. The global Mutlisite search plugin creates a view table of all of the differnt blogs posts and searches against that. It doesn’t use any kind of custom taxonomies so unless I rewrite how it duplicates posts this will never work.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Trying to get co-authors working with global search.’ is closed to new replies.