Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Read in blog posts from Wordpress but keep wp-admin


Go to End


4 Posts   1498 Views

Avatar
lozhowlett

Community Member, 151 Posts

8 November 2012 at 12:52am

Hi everyone

I am building a new site which has an existing wordpress blog. The client wants to keep the admin system for their wordpress blog (there is no movement on thats, its 100% they want it). So I want to build something in SS3 than will read only (i.e. not store in the database) blog posts from their wordpress database and show up in the silverstripe front end (i.e. admin of SS wont see any of the blog posts, they just see a page holder called BlogHolderWP or something).

Any ideas on how I could go about this, as it means connecting to another database, etc?

Thanks for any ideas!

Avatar
nmshah

Community Member, 21 Posts

8 November 2012 at 1:11am

You can use rss from the wordpress blog to be displayed on your silverstripe site

Avatar
lozhowlett

Community Member, 151 Posts

8 November 2012 at 1:13am

Aer there any examples of this working, including bringing in tags, comments, etc?

Avatar
lozhowlett

Community Member, 151 Posts

8 November 2012 at 3:32am

For anyone who is also interested I have found the solution!

1. Create a folder "blog" in the root of you site, put the wordpress files in there
2. Import the existing WP database and set up, plus manage config variables in the WP database to point to yoursite.com/blog
3. Update the blog/.htaccess file to...

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>

# END WordPress

4. Update the SS3 .htaccess to

### SILVERSTRIPE START ###
<Files *.ss>
	Order deny,allow
	Deny from all
	Allow from 127.0.0.1
</Files>

<Files web.config>
	Order deny,allow
	Deny from all
</Files>

ErrorDocument 404 /assets/error-404.html
ErrorDocument 500 /assets/error-500.html

<IfModule mod_alias.c>
	RedirectMatch 403 /silverstripe-cache(/|$)
</IfModule>

<IfModule mod_rewrite.c>
	SetEnv HTTP_MOD_REWRITE On
	RewriteEngine On
	RewriteBase '/'

        RewriteCond %{REQUEST_URI} !^blog/(.*)$
	RewriteCond %{REQUEST_URI} ^(.*)$
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule .* framework/main.php?url=%1&%{QUERY_STRING} [L]

</IfModule>
### SILVERSTRIPE END ###

5. Theme your WP install with the same as your SS site
6. Use the RSS Reader widget to pull in latest blog posts from your WP blog install

Happy blog'in!