You can create the pages by using script. You can execute any script using the “$wpdb->insert” or
“$wpdb->query”.
For creating wordpress post or page you can use the wp_insert_post function. Before calling wp_insert_post() it is necessary to create an object (typically an array) to pass the necessary elements that make up a post. The wp_insert_post() will fill out a default list of these but the user is required to provide the title and content otherwise the database write will fail.
You can use following code for creating the page. This code will execute when only you are logged in to wordpress.
// Create post object $my_post = array(); $my_post['post_title'] = 'My post'; $my_post['post_content'] = 'This is my post.'; $my_post['post_status'] = 'publish'; $my_post['post_author'] = 1; $my_post['post_type'] = 'page', $my_post['post_category'] = array(8,39); // Insert the post into the database wp_insert_post( $my_post );
You can create wordpress plugin and use this code. Use following code for wordpress plugin. Copy the code and create the create_wordpress_pages.php file and put in plugin folder.
/*
Plugin Name: Create WordPress Pages
Plugin URI: http://images.wordpressapi.com/
Description: Create wordpress pages by script
Version: 1.0
Author: wordpressapi
Author URI: http://images.wordpressapi.com/
*/
function create_wordpress_pages(){
// Create post object
$my_post = array();
$my_post['post_title'] = 'My post';
$my_post['post_content'] = 'This is my post.';
$my_post['post_status'] = 'publish';
$my_post['post_author'] = 1;
$my_post['post_type'] = 'page',
$my_post['post_category'] = array(8,39);
// Insert the post into the database
wp_insert_post( $my_post );
}
register_activation_hook(__FILE__, 'create_wordpress_pages');






Exactly what I needed! Thank you. One question though: If I wanted to execute this as a script outside of the administration area. How would I do that? For example, imagine a script that, once a day, adds a new article from a pull of articles I have defined to it and this way I do not have to manually post future items…
I am assuming you'd have to include some admin functions in the header as well as wp-connect, etc. But am not sure which exactly. Any help would be appreciated.
I was just having a conversation over this I am glad I came across this it cleared some of the questions I had.
I’ve just started off a blog, the knowledge you give on this site has aided me extremely. Thank you for all your time & work.
Nice post! You truly have a wonderful way of writing which I find captivating! I will definitely be bookmarking you and returning to your blog. In fact, your post reminded me about a strange thing that happened to me the other day. I’ll tell you about that later…
Great read. Thanks for the info!
Would it be possible to do this through an URL? What I want is to display SMS messages that are send by our teammembers on the road. The messages are for our followers. It’s like a messageboard.
I’ve found a SMS serviceprovider where the messages come in and they call an url like this:
http://www.yoursite.nl/sms/incoming.php?shortcode=1008&keyword=EXAMPLE&message=Example& originator=31612345678&operator=02F440& receive_datetime=20110921142314&mid=9000123
The keyword is a word that only we know (sort of password if you like) and the message is the thing we want to display in the posting that should be generated from this (or added to an existing page, that would be great too).
Receive_datatime my also be usefull.
Does anybody know of a way to archieve this?
I REALLY liked your post and blog! It took me a minute bit to find your site…but I bookmarked it. Would you mind if I posted a link back to your post?
Hello, this is my first time i visit here. I found so many interesting in your blog especially on how to determine the topic. keep up the good work.
I would like to say “wow” what a inspiring post. This is really great. Keep doing what you’re doing!!
Interesting read, perhaps the best article iv’e browse today. We learn everyday cheers to you!
Thanks for posting. Good to see that not everyone is using RSS feeds to build their blogs
This post makes a lot of sense !
I REALLY liked your post and blog! It took me a minute bit to find your site…but I bookmarked it. Would you mind if I posted a link back to your post?
Interesting read, perhaps the best article iv’e browse today. We learn everyday cheers to you!
I’ve been checking your blog for a while now, seems like everyday I learn something new
Thanks
I would like to say “wow” what a inspiring post. This is really great. Keep doing what you’re doing!!
I’ve just started off a blog, the knowledge you give on this site has aided me extremely. Thank you for all your time & work.
Good! Thank you! I always wanted to write in my site something like that. Can I take part of your post to my blog?
Hello, this is my first time i visit here. I found so many interesting in your blog especially on how to determine the topic. keep up the good work.
Good! Thank you! I always wanted to write in my site something like that. Can I take part of your post to my blog?
Nice post! You truly have a wonderful way of writing which I find captivating! I will definitely be bookmarking you and returning to your blog. In fact, your post reminded me about a strange thing that happened to me the other day. I’ll tell you about that later…