Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro Using plugin on multisite with custom post

Tagged: 

Viewing 8 posts - 1 through 8 (of 8 total)
  • Shaan Nicol
    #237004

    I have a multisite website (10 sites) that have a custom post type called members…. on the main website. I want to display the members from the other websites. here is how I set it up

    http://www.mainsite.com/subsite-1/subsite-2-list/
    http://www.mainsite.com/subsite-2/

    On subsite 1, I need to display the custom post type MEMBERS on subsite 2, I created a form on subsite 2 and chose the shortcode display method, I indicated that the results should display in http://www.mainsite.com/subsite-1/subsite-2-list/

    [searchandfilter id="2"]
    [searchandfilter id="2" show="results"]

    then on functions.php of subsite-1, I created a function that calls the shortcode created/from subsite-2 like this

    // Add Shortcode
    function view_mems() {
    	switch_to_blog( 2 );
    		$output = do_shortcode('[searchandfilter id="2"]');
    		restore_current_blog();
    		return $output;
    }
    add_shortcode( 'viewme', 'view_mems' );
    
    // Add Shortcode
    function list_mems() {
    	switch_to_blog( 2 );
    		$output = do_shortcode('[searchandfilter id="2" show="results"]');
    		restore_current_blog();
    		return $output;
    }
    add_shortcode( 'listme', 'list_mems' );

    On http://www.mainsite.com/subsite-1/subsite-2-list/, I then used the shortcodes/function above to display the forms from subsite-2, this works all fine, pagination works and displays the posts BUT the search form doesn’t work with or without ajax enabled, if you click submit, it just reloads the page and doesn’t do a search.

    Trevor Moderator
    #237018

    Our search creates cache tables for each site on the multisite, and within each site, does not look at the cache tables in another site, hence the search itself would not work.

    I will ask our developer, Ross, if there is any way to achieve what you want.

    Shaan Nicol
    #237022

    Manually adding the search parameters like http://www.mainsite.com/subsite-1/subsite-2-list/?_sf_s=SEARCHTERM&sort_order=title+asc works perfectly too.

    Ross Moderator
    #237026

    Hi Shaan

    While we don’t support searching across multisites, I would have thought what you are trying to do might be possible (with switch_to_blog) at least to access another sites particular set of results.

    What I will say is, the search form is entirely submitted by Javascript, so I’m thinking, maybe on your subsite, you don’t have the S&F javascript loaded in the page head?

    Thanks

    Ross Moderator
    #237028

    Also, in your main site Search Form, did you set the “results URL” to the results URL of your sub site?

    Shaan Nicol
    #237031

    The main site also has a page that lists its own members, so there are 2 forms/pages on the main site:

    http://www.mainsite.com/subsite-1/subsite-1-list/ and http://www.mainsite.com/subsite-1/subsite-2-list/, both have unique search forms.

    http://www.mainsite.com/subsite-1/subsite-1-list/ works as it should. The search form for this page is set to display the results to http://www.mainsite.com/subsite-1/subsite-1-list/

    While the other search form, the form from the other website inside the multisite is set to display on http://www.mainsite.com/subsite-1/subsite-2-list/, all JS are in wp_head

    Shaan Nicol
    #237101

    Checked again…. found that http://www.mainsite.com/subsite-1/subsite-2-list/ did not have the S&F js.
    I added them manually and now everything works!!!

    Ross Moderator
    #237124

    Great stuff, glad you got it working 🙂

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘Using plugin on multisite with custom post’ is closed to new replies.