Can a separate WordPress (same server) get posts from an existing one, but have different settings? - mysql

When developing WordPress themes for a site with a large amount of posts, how can I dynamically pull existing post data from the live version of the site onto my testing site? I already know about WordPress's export feature, but that's one-and-done, not dynamically queried.
Plan A:
Proposed Solution:
Create read-only user in live site's database
PRECAUTION: change test site's prefix from "wp_" to "test_"
Problems:
Settings (like current theme) on test site cannot be changed, thanks to read-only user
No posts found in "test_posts", even though I'd like it to search "wp_posts"
Is there an easier way or existing solution to avoid rewriting WordPress system files on the test site? I'd really rather not rewrite WordPress's database interface...
Similar: Linking themes across WP installations

just duplicate the DB, re-name and call DB in wp-config!

Related

Migrating From a Combined Hand Crafted Website and WordPress to Only WordPress

I've migrated a hand crafted website to WordPress website. The previous implementation did have WordPress in a sub directory for a blog. Apparently the admin for the blog was not the owner of the website, I couldn't get the admin username and password from the owner so I couldn't use the duplicator plugin. Due to time constriction I was not able to merge the blog into the new website prior to removing the active blog.
I have all the files and the database (in database.sql form) from the previous version of the website.
I have found the database table diagram at Codex, but I'm most interested in the minimal number of tables necessary to transfer.
What tables from the old database do I need to import into the new database (after changing all the absolute links to the correct addresses)?
I know about the wp_postmeta table and wp_posts table, are there any others I need to import.
It depends on what data you want to preserve.
The main data types and tables are:
Terms (wp_term_relationships, wp_term_taxonomy, wp_termmeta, wp_terms)
Comments (wp_comments, wp_commentmeta)
Users (wp_users, wp_usermeta)
Do you not want to just import the whole .sql file and start from there? That might be easier than trying to piece things together. You could then drop any table than doesn't being with wp_ (or whatever prefix you used).

Merging two WordPress Post/Comments tables in MySQL phpMyAdmin

I know the "merge tables" question has already been asked in a variety of ways, but I can't seem to find an answer to my specific question.
Here's my deal: I've been designing a WordPress site for an organization for four weeks. When I began designing I took an export of the database and imported into my local development site. In the meantime, this organization has naturally continued to post things and receive/approve comments on their live site. On the local side, I have also created posts, edited pages, changed widgets, etc during development. So now that we're ready to launch the new site, I need to figure out how to merge these last four weeks of database changes from both the live site and the local site without losing anything on either side. How is this done?
If there have been inserts to both databases, then unfortunately there isn't a good way to merge. If your database contains the latest edits for the Post IDs that are shared then you can export them to XML and then import them into the other site.
This is done with the WordPress Importer plugin which can also be installed by visiting /wp-admin/import.php, the export can be done on /wp-admin/export.php. You can also remove any conflicts from the XML file manually, but make sure that you keep it well-formed.

Wordpress theme editing

Well, I am a newbie with Wordpress.
I just got a free wordpress theme. I want to edit the pages to my customization. I have a shared host which provides MySQL database.
Can I edit this wordpress theme to connect to this MySQL database and pull/push data in to my database?
Is the whole process similar to working with normal php and MySQL? Whats so much difference with the set of php's being a Wordpress theme?
Thanks
Themes are just a bunch of php files which get executed in response to some particular event (basically when a particular kind of page nees to be rendered). You can do whatever you want in them, but everything which is not meant to be "aestethic" should probably be developed in a separate set of custom plugins. You then call those from your theme.
Once you have wordpress installed with the hosting provider and the database connection between the WP installation and the hosting provider MySQL database you can edit your theme through WP itself.
Make sure you set the permissions on the WP-Templates (I think thats what it is called) folder to read/write so that wordpress can write to the template files.
View the following link for any help editing the template. How to edit a WP Template
The theme is just the interfacce of your system, on your theme you only show the data, you need to run a select for instance in the apropriate part, also for the bussines logic.
If you do in the interface, in time your system will mess up.
In the official documentation have plenty of examples and How to's,..
The short answer - there are a number of different templates for the index, search, archive, page and article views of a Wordpress theme. Some themes don't include all of them - certain templates are the default for the other optional templates. You can edit them with software like Dreamweaver or a text editor of you choice, or you can alter them from the Wordpress admin panel.
Wordpress themes are a little too complicated to explain in one simple answer, but I can recommend a tutorial. It's a little dated, but it will explain the overall ideas and it's quite good.
Here's another - I've not read it over but it looks to be well done: http://themeshaper.com/wordpress-themes-templates-tutorial/
A theme is a collection of PHP files along with related files (CSS, JavaScript, images, etc.) that control the appearance of the WordPress site. The content (posts, pages, comments, options, plugin configuration, etc.) of the blog is stored in the database. Any themes on the site are thus separate from the content.
Themes can normally be edited directly from the WordPress admin console. Click on "Appearance" and then on "Editor". You can then edit any of the current theme's files from there. Useful for tweaking things if you know what you're doing, but dangerous in some ways because there's no easy way to undo your changes. Do a backup of your theme before noodling with it.
This entry in the WordPress Codex will help:
http://codex.wordpress.org/Editing_Files

moving wordpress mu to another domain - sql statements

I'm assuming these instructions are for "normal" wordpress... will this work with wpmu or do i need to modify this? Is there anything i should watch for?
http://www.mydigitallife.info/2007/10/01/how-to-move-wordpress-blog-to-new-domain-or-location/
See Moving WordPress « WordPress Codex and WordPress Serialized PHP Search Replace Tool
The biggest issue you face is changing URLs in the database; and you will need to change these URLs in each of the individual databases that Multisite installs uses. Check out the find/replace tool linked above; it correctly deserializes/serializes data in the database. If you change URLs in a text database dump, or with SQL queries as in the link you listed in your question, you risk breaking data, such as theme options and widget settings.
1/09/2016 Note: WordPress MU doesn't exist anymore. MU was rolled into WordPress core in version 3.0.

Wordpress post sync / publish to production

I'm using wordpress as a simple backend CMS for a flash site. Posts are queried and displayed in list format on the frontend. I want to be able to make post edits or add new posts on my staging server, and have a quick and easy way to publish changes to production without having to do a full mysql db dump / import. I've looked around for plugins or solutions but haven't found any. Seems like wordpress needs a "publish to production" option.
The intended workflow is that users can create or edit content as much as they want, then an editor will go through it and approve content. Once everything looks good on staging, we publish to production. Any ideas?
Some of this thread at Wordpress might be relevant for you as it concerns moving from staging to production and the use of relative and absolute paths, etc.
WordPress does have a preview button that should allow you to see the WP content without actually publishing. If you must see it in the flash site, I think your best bet will be to setup your flash site with XML-PRC.