Connect2site Plugin Widget

WP Plugin:: Connect2site Plugin Widget

by filos on February 16, 2009 · 35 comments

in Plugins, wordpressall

This plugin can be used to connect to another wordpress blog. I created this widget to display a list of posts from another blog of mine that resided in a subdomain on the same server. The options you have is to display posts from multiple categories from your sub blog.

Let’s say that you have a blog www.yourblog.com and another blog named sub.yourblog.com and you wish to display a list of posts in your www.yourblog.com from sub.yourblog.com what you can do is install the plugin in www.yourblog.com and configure it. This plugin needs some information in order to connect to the database of your other blog. You can find all the needed information in your wp-config.php file of your sub.yourblog.com. You can display a summary of each post including a link to the category that it belongs to.

Installation

Unzip the plugin/widget into your plugins directory and activate it
Usage:

  1. go to Settings and select Connect2Site
  2. write a header for the widget (if you use one)
  3. enter 
    • Category ID = the category  ID number of the category that you want to display posts from (in the example from sub.yourblog.com). You can specify multiple categories delimeted by comma (i.e. 22,44,55)
    • the database name of your sub.yourdomain.com (check your wp-config.php file ***)
    • DB Prefix = the DB_prefix usually wp_ 
    • dbUser = the user name that connects to your sub.yourdomain.com database
    • dbPassword =  the password of the user above
    • Domain =  is the full domain name to connect when you click a post (in the example sub.yourdomain.com)
    • Limit Posts = how many posts you wish to be displayed
    • Limit Summary = the number of characters to display from the post content
    • Display category name = check it if you wish to display the category name (and a link)
    • Display comment count = check it if you wish to display a comment count
    • Open in new window = if checked the output will be displayed in a new window
  4. click Update settings
  5. You may use the widget for your sidebar

connect2site1

You can see an example of the widget in my sidebar with the title WWW.KOUNOUPAKI.GR. In this widget I have selected two different categories, category and comment display. Links to my blog are opened in new window (may be it looks Greek to you but it is !). Check out the short codes here.

*** wp-config.php sample. The required fields are marked as WIDGET FIELD

1
2
3
4
5
6
7
8
// ** MySQL settings ** //
define('DB_NAME', 'mywordpress_db');    // THIS IS WIDGET FIELD dbName
define('DB_USER', 'dbusername');     // THIS IS WIDGET  FIELD dbUser
define('DB_PASSWORD', 'mysecretpassword'); // THIS IS WIDGET FIELD dbPassword
define('DB_HOST', 'localhost');    // 99% chance you won't need to change this value
define('DB_CHARSET', 'utf8');
// You can have multiple installations in one database if you give each a unique prefix
$table_prefix  = 'wp_';   // THIS IS WIDGET FIELD DB prefix

Troubleshooting: in case of a problem deactivate the plugin or delete it from your plugin directory.

DOWNLOAD Connect2site

RELEASE HISTORY

CURRENT RELEASE Connect2site 1.2.3

  • Minor fixes
  • CHANGE:Added connect2site id for CSS playground

RELEASE Connect2site 1.2.2

  • BUG FIX: When no post limit is set you get a DB error
  • CHANGE:Display Posts in descending order (latest first)

RELEASE Connect2site 1.2.1

  • Added H3 tag in post title when using post short code

RELEASE Connect2site 1.2

  • Changed: moved widget setup to settings
  • Added: Short codes to display results in Posts and/or Pages
  • Added: Short codes with various independent options to dipsplay more categories
  • Added: Short code to display a single post in a page (full or exceprt content)

RELEASE Connect2site 1.1

  • Added: Multiple category selection (more than one category post dipslay)
  • Added: Display (on/off) post summary (limit number of characters)
  • Added: Display (on/off) comment count
  • Added: Display Category (with link to sub blog category id)

RELEASE Connect2site 1.0
Initial Release

Popularity: 100% [?]

{ 10 trackbacks }

{ 25 comments… read them below or add one }

1 baron 02.14.09 at 12:32 am

hi. Thanks for plugin

perfect.

Regards

2 filos 02.14.09 at 12:42 am

Thanks baron, soon I will add some more features to the plugin to be more attractive. Suggestions are welcomed !
ML

3 Jose Perez 02.14.09 at 1:29 am

I don’t undestand but it looks like if you add to the sidebar the RSS of other site isn´t it?

Regards

4 brad hart 02.14.09 at 3:27 am

I agree with Jose that this could be accomplished very easily simply using an rss feed widget and a category, tag, or even author feed all of which are standard in wordpress. That said I do see future development possibilities that could be put to cross posting from other blogs into your established category structure, that sort of area has a great deal of potential for Wordpress MU blogs.

5 filos 02.14.09 at 12:46 pm

@Jose Perez: your are almost right but this widget is the first step. It looks like incorporating a simple rss feed, but in future development the main blog actualy can be a union of multiple blogs and or cross posting (as brad hart said). The second step to this widget will be multiple categories, post summaries and direct link to the sub blog category posts.

6 ali 02.15.09 at 3:15 pm

Great. I just look around for this. I think it’s not same with rss feed, it will be more customizable

7 filos 02.15.09 at 4:11 pm

Hi ali, check the description of the upcoming version 1.1 it has more options.

8 Rasit 02.16.09 at 9:31 pm

super plugin. thanks…

9 yudhiie 02.20.09 at 5:20 pm

finally i found this super plugin,thanks

10 filos 02.20.09 at 5:32 pm

@Rasit and @yudhiie
Thank you for your comments.

11 George Serradinho 02.25.09 at 7:25 am

Hi and thanks for this wonderful plugin. I’m sure a lot of users that have multiple blogs will enjoy this.

Would be nice if you could also get other info from other domains and not just sub-domains.

12 filos 02.25.09 at 10:29 am

Hi George,
thank you for your comments. This plugin actually works for domains located in the same server (not only subdomains). What I am considering is adding more connections to subdomains at the same time, but it don’t think that’s a good idea.

13 Stephen Kastner 03.07.09 at 12:26 pm

Not sure why I am getting these errors but otherwise it looks and works great! Thanks!

Warning: extract() [function.extract]: First argument should be an array in /home/nourisho/public_html/wp-content/plugins/connect2site/connect2.php on line 28

Warning: mysql_close(): supplied resource is not a valid MySQL-Link resource in /home/nourisho/public_html/wp-content/plugins/connect2site/connect2.php on line 120

14 filos 03.07.09 at 4:05 pm

@Stephen
I visited your blog. Please provide me with some info : are you using the latest version of the plugin ? I have some issues with the wordpress plugin repository and the latest version is not showing in the main page. If you are not using the latest version please download it – version 1.2.1
-I see you are using multiple categories so check for spaces between category ids (you should separate them with comma)
-Are you including an empty category ?
-Which is your category (the name) that the plugin does not display ?
Michael

15 Lisa 03.17.09 at 8:22 pm

Awesome plugin, just what I needed THANKS!

16 gulflee 03.25.09 at 10:33 am

Warning: extract() [function.extract]: First argument should be an array in /home/nourisho/public_html/wp-content/plugins/connect2site/connect2.php on line 28

Warning: mysql_close(): supplied resource is not a valid MySQL-Link resource in /home/nourisho/public_html/wp-content/plugins/connect2site/connect2.php on line 120

Stephen, i just remove extract($args); on line 28
and line120 the connection close not $rst but it have to close $db.
hope some one correct me if i m wrong;

17 filos 03.25.09 at 10:50 pm

@gulflee: you are right on the db parameter, there is a new version coming up. But don’t take the extract($args) out from the widget function !

18 gulflee 03.26.09 at 5:52 am

filos, i m trying to make the “get_target_post()” work, direct call from single post.
$sql = ’select id as s_id, post_title as s_title, post_content as s_Content, post_excerpt as s_Excerpt, comment_count as s_Comments from ‘.$connect2_pre.’posts where ‘.$connect2_pre.’posts.post_type=”post” and ‘.$connect2_pre.’posts.ID =”449″‘;
but it return nothing when “$rst = mysql_query($sql, $db); print_r (mysql_fetch_assoc($rst));”. When ever single post is specific it return nothing(wp_posts.ID=”449″). Can help?

19 filos 03.26.09 at 10:00 am

@gulflee: the proper call in a page or a direct post is through the short codes, for example if you want to import the full post with ID 449 you enter in the single post the following short code: [c2s type="post" num="" chars="" cat="" post="449" exc="0"] or if you want to import just the excerpt [c2s type="post" num="" chars="" cat="" post="449" exc="1"].
I haven’t managed to simulate the error you are getting. Are you calling the function using a PHP call to the get_target_post(arg1,arg2) function ?

20 balej 03.31.09 at 6:25 am

i am wanting to link to multiple subdomains. is there a way to install this using another name such as “connect2site-1″ or “connect2site-a”, or whatever? It is a great widget and does exactly what i want, but I need to link to two or three at the same time.

21 filos 03.31.09 at 8:57 pm

@balej , the current version of the plugin supports one subdomain.

22 Derek Barkley 04.08.09 at 3:55 am

I don’t use widgets I hand code my themes. Is there a way to use your plugin w/out the widget. Can I do something like and have it display?

23 filos 04.11.09 at 12:27 am

@Derek, in the latest version of the plugin there is no need to add the widget to your sidebar. Your options are 1) use the shortcodes 2) check out the source code to see the functions and parameters that the short codes are using and use them in your theme for example :

1
 <?php echo get_target_post(35,1); ?>

Displays the excerpt of a single post with ID 35.

In case of a problem check if you are missing the parameter loading that you have entered in the plugin setup.

24 DB 05.15.09 at 8:45 pm

Wow this is exactly what I’ve been looking for, I think. If I can make this work on MU it would be amazing. (this should really be built into the MU core, imo)

25 eva 06.09.09 at 6:18 pm

about to install this plugin. testimony soon.

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous post: WP Theme:: KounoupakiTwo Theme

Next post: WP Theme:: kounoupaki3