This calls back to a Rails (or other) web service to get theme information, so that it is easy to keep the rails and WP sides in sync.
The plugin itself is easy to install.
/wp-content/plugins/ directory.There are a number of things that have to happen on the Rails side, though.
You will need something like the following in your routes.rb file:
get "/wrapper" => "home#wrapper"
And it should return a partial with three sections. The sections should be separated from each other with 10 tildes (that
is: ~~~~~~~~~~).
It is most convenient to rearrange your layout file to call those three partials. Here is a possible layout file:
<!DOCTYPE html>
<html>
<head>
<%= render :partial => '/layouts/dependencies' %>
<title>Site Title</title>
</head>
<body>
<%= render :partial => '/layouts/header' %>
<%= yield %>
<%= render :partial => '/layouts/footer' %>
</body>
</html>
Notice that all the work is done by those three partials.
Then, the wrapper call is handled like this:
def wrapper
render :partial => "/layouts/wrapper"
end
<%= render :partial => "/layouts/dependencies" %>
<%= render :partial => "/layouts/any_session_related_tasks %>
~~~~~~~~~~
<%= render :partial => "/layouts/header" %>
~~~~~~~~~~
<%= render :partial => "/layouts/footer" %>
You will have to be careful about the css classes you create so that they don't conflict with the WP theme's classes. For instance, you probably don't want a class named 'content'.
You will also probably have to tweak the css in your layout some to override some of your theme. In the case of the 2011 theme, I had to put in the following:
/* for wordpress */
#body-container {
margin: 0;
}
#header-container {
display:none;
}
The big problem with making this seamless is that WP can't use the session data from the Rails app. Typically in
my apps, this means that I don't know how to draw the "sign in" section because I can't tell if the user is logged in.
To get around that, the sign in section should be drawn as if there is no one logged in, then an ajax call made from
the Rails app to correct that. That is what should go in the any_session_related_tasks partial above: some javascript
that triggers at onload time that returns the sign in div.
Requires: 3.2 or higher
Compatible up to: 3.5.1
Last Updated: 2013-1-22
Downloads: 248
Got something to say? Need help?