Prevent duplicate posts in wp_insert_post using custom fields

To save the link in the post meta you can use update_post_meta like this for example: $url = “http://sample.com/entertainment/default.aspx?tabid=2305&conid=102950” $my_post = array( ‘post_title’ => “$title”, ‘post_content’ => “$content”, ‘post_status’ => ‘draft’, ‘post_author’ => 1, ‘post_category’ => array(1), ); $post_id = wp_insert_post( $my_post ); update_post_meta($post_id,’source_link’,$url); and to prevent the insertion add a simple conditional check: $args … Read more

Display thumbnail from custom field

can you explain why do you need custom fields ? (personally i think they are HUGELY over-used.. especially for images ) if there is no specific reason why you need it , you could use the the_post_thumbnail(); function . like so : the_post_thumbnail(‘thumbnail’); // Thumbnail (default 150px x 150px max) the_post_thumbnail(‘medium’); // Medium resolution (default … Read more

How to add/save Custom Field in user settings/profile “Checkbox list”

Justin Tadlock has a good tutorial to get you started: http://justintadlock.com/archives/2009/09/10/adding-and-using-custom-user-profile-fields There are some specifics to dealing with checkboxes however, and some custom code if you want to make checkboxes that correspond to tags/categories. To generate the form fields and save the data use the following snippet: <?php function user_interests_fields( $user ) { // get … Read more

Rewrite custom post type url’s adding meta box values

It sounds like you’re very close here and your only remaining issue is that your permalinks for genres and movies collide. ‘movies’ CPT permalink /genres/%custom field meta box value%/%movie%/ ‘genres’ CPT permalink /genres/%genre%/ The issue here is using the add_permastruct. When it creates the rules for movies, they look something like this: genres/([^/]+)/([^/]+)(/[0-9]+)?/?$ => index.php?genre=$matches[1]&movies=$matches[2]&page=$matches[3] … Read more

I am trying to create a simple frontend form for posting

To post from the front-end you can use wp_insert_post() function. So its simply a matter of a form and processing it the form: <!– New Post Form –> <div id=”postbox”> <form id=”new_post” name=”new_post” method=”post” action=””> <p><label for=”title”>Title</label><br /> <input type=”text” id=”title” value=”” tabindex=”1″ size=”20″ name=”title” /> </p> <p><label for=”description”>Description</label><br /> <textarea id=”description” tabindex=”3″ name=”description” cols=”50″ … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)