I need some help with this form http://www.samfordtennis.net/newform.php so that joining members can add up to six in total family members. At present, you select membership type for the main member… (Budget: $30-250, Jobs: AJAX, jQuery / Prototype, PHP)
WordPress: How to insert data programmatically
Inserting posts
Do you remember back in 2008, when I created WP Vote? This site was the first (as far as I know) social voting site created 100% within WordPress. Users were able to submit a story, which was automatically published on the blog.
Inserting a post programmatically in WordPress is extremely easy. You have to use the wp_insert_post() function, which takes an array as a parameter.
Here is a working example. If you want to test it, paste the code below on your functions.php file.
global $user_ID;
$new_post = array(
'post_title' => 'My New Post',
'post_content' => 'Lorem ipsum dolor sit amet...',
'post_status' => 'publish',
'post_date' => date('Y-m-d H:i:s'),
'post_author' => $user_ID,
'post_type' => 'post',
'post_category' => array(0)
);
$post_id = wp_insert_post($new_post);
Cool, isn’t it? Let have a closer look to the parameters specified in the $new_post array:
- post_title: the name of the post.
- post_content: the content of the post
- post_status: the post status (published, draft, etc)
- post_date: use date() or specify a custom date
- post_author: Author id of the post author
- post_type: Can be post, page, or a custom post type
- post_category An array of categories ids
Source: http://www.webmaster-source.com/2010/02/09/programmatically-creating-posts-in-wordpress
Inserting comments
Inserting comments is not harder than inserting posts. I personally never used this code, but here is it in case you need it. To give it a try, simply paste it in your functions.php file.
$data = array( 'comment_post_ID' => 1, 'comment_author' => 'admin', 'comment_author_email' => '[email protected]', 'comment_author_url' => 'http://www.catswhocode.com', 'comment_content' => 'Lorem ipsum dolor sit amet...', 'comment_author_IP' => '127.0.0.1', 'comment_agent' => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; fr; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3', 'comment_date' => date('Y-m-d H:i:s'), 'comment_date_gmt' => date('Y-m-d H:i:s'), 'comment_approved' => 1, ); $comment_id = wp_insert_comment($data);
Just like the wp_insert_post() function, wp_insert_comment() takes an array as a parameter. Here are the data used:
- comment_post_ID: ID of the commented post
- comment_author: Name of the comment author
- comment_author_email: Email address of the comment author
- comment_author_url: Website of the comment author
- comment_content: Text of the comment
- comment_author_IP: IP address of the comment author
- comment_agent: User agent of the commenter browser
- comment_date: Date of the comment
- comment_date_gmt: GMT date of the comment
- comment_approved: Is the comment approved? 1 for yes and 0 for “awaiting moderation”
Adding categories to a post
Now that we saw how to insert a post or a comment into WordPress database, let’s see how to make a post part of one (or more) categories. WordPress has a built-in function for that, named wp_set_object_terms().
What you have to do is to create an array with the desired categories ID, and then use the function as shown below:
$category_ids = array(4, 5, 6); wp_set_object_terms( $post_id, $category_ids, 'category');
The wp_set_object_terms() function take 3 parameters: The post ID, an array of categories ID, and the taxonomy type (In this example, category).
Adding tags to a post
Adding tags to a post is extremely simple as well. Even better, it does not require a new function, you can do so by using wp_set_object_terms().
Take a look at the example below:
$tag_ids = array(7, 8, 9); wp_set_object_terms( $post_id, $tag_ids, 'post_tag');
Looks very similar with the previous piece of code, which allowed us to add categories to a post, isn’t it? In fact, the only difference is the taxonomy type: Here the parameter is post_tag instead of category.
Source: http://wpprogrammer.com/snippets/add-a-category-or-tag-to-a-post-programatically/
Automatically create a custom field when a post is published
I recently had a client who wanted to have a custom field created automatically, each time he published a new post, so he wouldn’t have to create a custom field with a default value for each article he wrote.
This piece of code was a real life-saver: Just paste it on your functions.php file and publish a new post: A custom field has been created automatically.
function add_custom_field_automatically($post_ID) {
global $wpdb;
if(!wp_is_post_revision($post_ID)) {
add_post_meta($post_ID, 'field-name', 'custom value', true);
}
}
add_action('publish_page', 'add_custom_field_automatically');
add_action('publish_post', 'add_custom_field_automatically');
So how does it work? First, a function has been created. This function make sure the post isn’t a revision on then adds a custom field named field-name, with custom value as a value.
Then, a “hook” is used to make sure that every time a post or page will be published, the add_custom_field_automatically() function will be called.
Source: http://wpcanyon.com/tipsandtricks/adding-a-custom-field-automatically-on-postpage-publish/
Like CatsWhoCode? If yes, don’t hesitate to check my other blog CatsWhoBlog: It’s all about blogging!
WordPress: How to insert data programmatically
Video Presentations For Guys Actors Only by franco86
Hi, I need a GUY with US/Aus/UK accent (Preferably US) who can do 3-5 video presentations (Around 5-15 min) like http://masscontrolsite.com/blog/?m=200911. The videos you’re doing need you to show yourself with the integration of some power point slides in between… (Budget: $250-750, Jobs: Video Broadcasting, Video Services, YouTube)
Looking For Real WordPress Pro
I have a client that owns www.howcelebritiesloseweight.com
This blog has been working great until the hosting company took it down for few hours. Once they put it back up all the banners shifted to the bottom of the blog.
I hired someone from scriptlance to fix it, and he fixed the shifting problem but created another problem. Although the code for the Google Adsense is in each post, the ads are not showing. In addition the site is a lot slower now. That might have something to do with a couple error messages that I am getting when I try to log into the admin panel of wordpress that says:
Fatal error: Out of memory (allocated 66584576) (tried to allocate 35 bytes) in /home/celeb77/public_html/wp-includes/taxonomy.php on line 674
and
Fatal error: Out of memory (allocated 65798144) (tried to allocate 16 bytes) in /home/celeb77/public_html/wp-includes/category.php on line 350
While this guy was trying to correct these problems, the hosting company took the site down again and made the navigation bar disappear and the page navigation is also not working right.
To get an idea what the site should look like with the navigation bar on the header, the Google Adsense ads and the page navigation, take a look at a sister site that was created based on this site that we are working on. The sister site is www.howcelebsgetfit.com
In addition create a new page and have it show on the navigation bar (I will provide code) that will be an amazon store!
So I need a PRO to fix all these little issues.
Request A Cost Estimate
Php Scripts Tutorial Writers
TransDeluxe.com is looking for tutorial writers for all the popular scripts, such as WordPress, Joomla, phpBB, vBulletin, Drupal, Mambo, etc.
You will need knowledge of PHP and htaccess rewrites to create tutorials for us.
We are paying $50 per tutorial written.
For more information and contact please visit: http://www.transdeluxe.com/tutorials.html
Thank you for your time.
Hiring Php Tutorial Writers
TransDeluxe.com is looking for tutorial writers for all the popular scripts, such as WordPress, Joomla, phpBB, vBulletin, Drupal, Mambo, etc.
You will need knowledge of PHP and htaccess rewrites to create tutorials for us.
We are paying $50 per tutorial written.
For more information and contact please visit: http://www.transdeluxe.com/tutorials.html
Thank you for your time.
Tutorial Writers Needed For Mu
TransDeluxe.com is looking for tutorial writers for all the popular scripts, such as WordPress, Joomla, phpBB, vBulletin, Drupal, Mambo, etc.
You will need knowledge of PHP and htaccess rewrites to create tutorials for us.
We are paying $50 per tutorial written.
For more information and contact please visit: http://www.transdeluxe.com/tutorials.html
Thank you for your time.
Small Design Update
Hello,
I need to update the design of 3 pages. You can see the pages here
http://bit.ly/cnuWT1
http://bit.ly/cXPRZQ
http://bit.ly/aPS6yw
I basically want to modify the footer and header slightly and then make some small mods so that the overall design is cleaner,sleeker, etc. It still all looks a bit sloppy to me.
I also then want a preview beta-page just to say that the site will be launching soon and a person can enter their email address to get on the waiting list.
WordPress Sidebar Issue
I’m sure what I need is a 10 minute job – I just don’t know where to begin! I have a broken text link in a sidebar widget, plus I need to add another widget to the sidebar – a simple graphic with a link. You can see this at http://www.floss.com/homepage.html -the broken link is on the left side under eBooks, and I would also like to add a graphic with link to the right sidebar.
Need 1120 Quality Tweets.
I need someone to write 1,120 tweets for my twitter account. They MUST be no more than 140 characters
1. The law school admissions process
2. New minority initiatives at law schools. (w/ articles linked in tweets)
3. LSAC Deadlines approaching
4. Hiring practices at law firms
When bidding please quote me how fast you can deliver the tweets and a brief overview of how you intend to do this. At the end of every tweet you must put #fb so that they will sync to my facebook fan page.
I will need them posted in the e-mail, separated by tweet #.
Any past work with references is a must and should be provided along with the bid.
Your final work will be thoroughly checked by for any grammatical errors as well as ensure that all links are valid.
Please include with your bid:
* Price
* Accurate date of delivery
WILL HIRE AGAIN after that project if properly done.
DON’T OFFER ANYTHING ELSE PLEASE! GIVE ME A REAL PRICE!
Link Building
Please submit your credentials and past SEO achievements in PMB after bidding.
URL & keyword details will be provided through PMB
We are only looking for long term sustainable SEO, i.e. no 30-day blip in Google SERP, but for long-term high-SERP thanks to quality links and quality work.
All agreements will be done via PMB.
We will give you five keywords.
Payment will be released as Google Ranking milestones are reached:
top 50 ranking: 15%
top 20 ranking: 20%
top 10 ranking: 30%
maintenance for 2 months: 35%
All links MUST MEET THESE requirements.
—————————————-
*Only white hat methods
*Home page page rank, iframes, other page ranks does NOT count
*Backlink pages must relate to our site topic
*Free one-way manual links.
*No more than 20 links must be submitted per day.
*Only legitimate ways
*One way links only (no reciprocal links)
*Links must be permanent, static html links
*Manual submitted text links only, with supplied key phrase/anchor text.
*Active sites only, no construction sites.
*Max Two links per domain / Class C IP
*No redirects, JavaScript links, hidden links, Flash sites/pages, or other unethical or black-hat tactics.
*Google guidelines for building links must be followed and no way should be compromised.
*No black-hat tactics. No blacklisted or Spam sites or spamming techniques. No banned sites, porn, gambling, violent, illegal, Link Farms or hate-based sites.
*Links must be on pages with 15 outbound links at most.
*Links must be relevant for law school admissions, minority law school admissions
*Links that are not approved will have to be replaced by service provider.
NOT ALLOWED:
*Directory submissions, forum posts, article submissions, links from guest books, within newsgroups, yahoo groups, CL sites.
*No hidden, cloaked, or redirected in any way
*No paid traffic/payment sites.
*Black hat and other unethical SEO. spam techniques. Only ethical work will be accepted.
*Links from rel=”nofollow” or “noindex” tag for pages themselves and for anchor text
*Robots.txt blocking, fake PR, banned by Google, Yahoo, Bing sites
*Use of automated software or bots.
*Java links, jump scripts, framed pages, redirects, cloaking, CSS redirects, 301 redirects, dynamic links, flash sites/pages, hidden links, no string parameters, session ID’s, etc.
*Link farms and link exchange programs or web rings such as backlinks.com, Gotlinks.com, linkpartners.com, linksToYou.com etc., no rented links, FFA sites, gambling, adult & porn sites, pharmacy sites, illegal websites, hate-based websites, violent websites, cracking or hacking websites, no blacklisted or spam sites, links from “bad neighborhood” sites (e.g. link farms, porn and so on), ping sites, etc.
*Links should not be listed on illegal and other offensive websites (spam, ban, or blacklisted)
*Scraped content, mirror sites, orphaned link pages, link schemes and sites overrun with contextual ads, popups, ads, sponsored links, intrusive advertising, classified sites, labeled links, etc.
**write I read the whole thing** on your pmb so I know you read the entire description.
We will require an excel report with the following info every two weeks.
– Site Title
– Site URL
– Site PR
– URL of page with link
– URL Page PR
– Anchor Text
– Date Submitted
– Date Accepted
Please provide us an example of your work. (i. e. one of your sites, similar work with an actual traffic and ranking report, and a few incoming links for that project you developed).
-References to similar successfully completed projects to indicate your work quality.
-A description of SEO techniques you will be using and how you intend to obtain the links during the project timeline
ANY BID NOT INCLUDING ALL OF THE ABOVE WILL BE IGNORED!
