I have a database with a few hundred devotions that I would like to start using on my Wordpress page. I am hoping not to have to copy and paste each of them into my Wordpress page. Is there a way to somehow merge the two? Thank you very much!
I have a database with a few hundred devotions that I would like to start using on my Wordpress page. I am hoping not to have to copy and paste each of them into my Wordpress page. Is there a way to somehow merge the two? Thank you very much!
What's the structure of the table holding all the devotions?..
What exactly do you want to do with them?...
If you can be specific i can proberly write you a short query to insert the data into your wordpress database tables, but you'll need to be specific about what you want done with the data...
I have a table with about 12 rows in it. One has a Scripture reference, one has a Scripture verse, one for each paragraph, etc.
They are set to display on our web site each day...each day of the year corresponds with a record number in the row.
I want to start displaying the devotions now in the Wordpress page, but I don't want to have to repaste all of them into the Wordpress page one at at time. I just want to move them into the WP database if possible. It would operate the same way, where the date would need to correspond with the publish date so that it would be published on the correct day of the year.
Thanks!
Hi,
Can you export a row from your the table, one is fine, so i can get a visual idea of the structure..
Of course if you just want to move a table from "database A" to "database B", phpmyadmin can help you do that ... you don't need a script..
Perhaps that may be a good place to start...
If you like, export a few rows, tell me the existing database name, and i'll do a few tests with it on my local install...
I think the biggest issue you'll have is deciding when you want to pull this data into wordpress, and where... and the exact usage..
It's easy enough to just create a table wp_example, plonk some data in it... but then it's just a table with data......
What would you like me to export it as? Should I email to you? I am willing to do whatever. If I cold use my table in the WP page and have it pull from my table it would be just fine with me.
Thnks
Are both these databases on the same server?
If they are the quickest way to get it into your wordpress database is via PHPMYADMIN...
Assuming you have only 1 table in the database you want to copy from..
You should now have the table copied to your wordpress database..
It will show in the list of tables in the wordpress database as "wp_yourname" , where wp_ is the prefix, unless you use something else, and where yourname, is the name you choose in Step 6...
Can you manage that ok?
Once we've got the database bit out the way i can make something for pulling the data for you...
Ok that is done! So far so good...:)
Is ther
Good job mate, now if you'd like to export 1 or 2 rows from that table...
Again, in PHPMYADMIN, same procedure (pretty much as before), but choose Export instead of Operations, then untick the "Save file to server" option.. .. near the bottom where you see the save options...
If the data isn't sensitve just open the .sql file in notepad, and copy and paste the contents into a pastebin (see link)..
http://wordpress.pastebin.com/
Then provide the link here... :)
Ok, and how do you want to interact with the entries?
I can make a basic plugin that allows you to use a shortcode..
Something like...
[devotions id="123"]
That would select the entry with the RecordNum 123....
Of course ID can be called something else... also the shortcode to, doesn't have to be [devotions], it could be [i like cookies] for all that it matters.. :)
Then when you're writing your post...
This is some text in the post, blah blah blah... [devotions id="1"]
Then some more text...
[devotions id="2"]
So you can just refer to which entry you need... throughout the post/page and it'll grab the necessary entry from the database... and plonk it in the appropriate place...
So where you see [devotions] above, will actually be the related entry from the database...
Hows that? ...
Of course i'll need a little time... but the above, i can do...
Ideally you'll need to be using a current version of WP, as i'm not use to coding for anything less then 2.7 ... as such some functions i call may not exist in pre 2.7 releases..
Thank you for all of your help. I don't think you are completely understanding. I would not actually want to interact with it at all. Devotions have been written for two years already, and someone is currently inputting them into our database. The only thing I would need is for one devotion per day to be published. All of the devotions are dated with record numbers, and we currently have a form that generates the devotion on our web page based on the record number. Record one would be January first, record 365 would be December 31, record 366 is January 1st, etc. We send these out by email also, so we will keep that form for that, but I would like to be able to do the same thing on our
WP page, because I want to establish a blog for our pastor as well. I hope this makes sense! I just installed WP, so I would think I would have the newest version.
Thanks,
Ok, well if you have a page that generates them, and someone that inputs the data for you, then i can't see what it is you want to do.... :)
Do you just want something that pulls the data, but onto a wordpress page?
Or a page that pulls an entry relevant to the day of the year?...
Any chance i can see the current page for the devotions and the page you want them on? ... perhaps to give me a clearer idea.. ;)
Sure! ;) This is the current devotion page:
http://mzbc.com/devotions/
I have never cared for the way the text looks on this page, but it is all done for us with a form (I can show that you that if you would like).
Our pastor is going to start an occasional blog, and I would like to use the new blog page for the devotions, so I would need to somehow tell WP how to do what our other page is currently doing.
Thanks again!
So basically the page currently selects an entry to match the day of the year? Is that correct?
I can mimic that no problem...
If you want something for managing the entries, i can hook it into the WP admin section. That may be more secure then your current form... it's impossible to say without seeing your current script..
And certainly curious to see the current form you mentioned...
That is correct. THe link below is the page source. I didn't write the code, a friend of mine did, but it works great. I just want to use the same page for this as we will for the blog, and I like the WP page better.
Again, I appreciate it.
Ooops, here is the link :)
http://wordpress.pastebin.com/d5b8f9c6e
Ok, so to just finally clear this up, you don't need anything other then a simple script you can place in a page that's displayed in Wordpress that will grab the matching entry for a given day...
Basically a Wordpress page that mimics the non-wordpress one posted above..
Ok i've knocked a page template you can use, it will have the desired effect, but i'll need to run through the process of how to set it up.. (don't worry it's easy)...
You'll need to accompany the page with some CSS to style the elements, but i can help you with that...
If you could just let me know regarding my last post, we can move along and get it up and running... (i'm not going to write a full run-down on what to do, until i'm sure we're clear on what it is we're doing.. lol).
Here's the code thus far, and you'll see, very easy to read, nicely formatted and it works... :)
http://wordpress.pastebin.com/m4aa17b14
If that's what you're after, then i'll follow up with instructions on what to do next..
Well I actually have a page designed already that I want to use from a template. The url is www.straightpaths.mzbc.com.
I want to be able to have the devotions automatically brought into this site. I guess maybe I could have just pasted the info from my other page into this one? I wasn't sure if that was doable with WP. Maybe I am making all of this way too difficult. Anyway let me know if this is still unclear. Thanks! :)
I'm not quite sure what you mean by automatically brought in.
Your previous link here.
http://mzbc.com/devotions/
And the code i posted here.
http://wordpress.pastebin.com/m4aa17b14
Will both grab a devotion from the database, based on the day, in other words dynamically, and that's what you seem to be asking for, unless i'm missing the point...
Try it and see...
Create a file named devotions.php , and place it in your theme folder..
Example:
/wp-content/themes/default/
Copy the code i posted above (use the bottom section of the page to avoid getting the line numbers etc..) , save the file.
Now goto in the Wordpress admin and click on pages "Add New" , give the page a title "Devotions" slug "devotions" , leave the content empty.
ADDTIONAL NOTE:: Select the devotions page template from the right-hand select menu before saving..
Now load up your page... you'll have a devotions page that selects a devotion from your wp_devotions table based on the day... as it did on the old page...
It will make more sense once you do it i'm sure..
Okay, I did that. I think maybe I missed a step somewhere. I uploaded the file into the theme directory that I am using, instead of the default, which I assume I should have done. You will see the link is now there, but the background is not white as it should be. I chose the devotions template, but I left the html section blank.
THanks a bunch!
Looks like it's due to invalid code in your header...
Namingly this bit firstly...
<div id="search01">
<form method="get" id="searchform" action="http://mzbc.com/straightpaths">
<label>
<input type="text" class="text_field" value="Search" name="s" id="s" />
</label>
<input type="image" src="wp-content/themes/Theme5/images//gobutton.jpg" border="0" value="Go"></div>
</form>
Taken straight from "View Source"....
If you can copy and paste the code from your theme's header.php in a pastebin i'll look over it and fix it for you.. ;)
Thanks. Here it is:
http://wordpress.pastebin.com/dbf709d
It looks fine though with my other pages, so I am not sure why an error in the heading would affect this page.
I imagine it should look like this, but i can only guess at best...
http://wordpress.pastebin.com/d5689670d
Since i'm essentially looking at one half of a layout.. but it looks right, aside from some extra elements that can be proberly be dropped from the code, such as this bit..
<div id="mainhead"></div>
I don't understand. This is what it should look like:
http://straightpaths.mzbc.com/
I just needs to have the devotions brought in daily.
I thought I sent that link earlier. If I did not, I apologize.
The link above is for your header.php, to fix the invalid code...
The problem you have with the devotions is due to the invalid code...
It's still up and running perfectly on my local test installation...
Font-size, colors etc, we can fix later, but that's not going to help while your page contains invalid markup......
This is why you are missing the white background...
If you're still stuck when i come to check back on the thread just zip up your theme and post a link, i'll do it for you... (just this once..) .. ;)
I am really sorry, but I think I let your pasted text expire. I was on the road all weekend and wasn't able to work on it. Is there any way I can find it again?
Sorry about that!
As has your link to the pastebin...
I'll take a look again if you'd like to plonk the code into a pastebin again.
Might be an idea to put both the header and footer (.php) code into one , or two seperate pastebin(s), just so i can see how many elements should and shouldn't be there...
Perhaps we should both choose "A month" when doing our pastebins this time... ;)
Okay, I pasted what I think you need. Just let me know if this is not exactly what you want. It should be there for a month! :) Thanks again for your help. I will start being more prompt in my replies now.
Not sure what file the code is from, i'd hazard a guess at the theme index.php
I think it would just be easier to zip up the theme...
Or just these files (index.php, footer.php, header.php).
It's hard to know what elements exist when i have 1 piece of the puzzle so to speak.
You could always give it a shot... by running your webpage through this and fixing the errors shown...
http://validator.w3.org/
You must log in to post.