Converting a working AJAX form to work with WordPress

You have a typo: wp_ajax_ ajaxfunction. there’s a space after the underscore. also, use wp_localize_script to set your admin-ajax path: wp_enqueue_script( ‘contact’, get_bloginfo(‘template_directory’) . ‘/subscribe.js’, array(‘jquery’), ‘1.0’ ); wp_localize_script( ‘contact’, ‘ContactAjax’, array( ‘ajaxurl’ => admin_url( ‘admin-ajax.php’ ) ) ); then in your javascript, use ContactAjax.ajaxurl

Embed IPB forums to wordpress page

Your best bet is to modify your IBP theme to bootstrap WordPress, and display the header and footer, you can do this by following this Codex article here. This will load the WordPress environment and allow you to use WordPress functions: <?php /* Short and sweet */ define(‘WP_USE_THEMES’, false); require(‘./wp-blog-header.php’); ?> Modify the require statement … Read more

Can I have two submit buttons in one form? [closed]

If you’re placing a button in a meta box, it is included within the FORM tags for a post. A simple answer is no, you shouldn’t place a submit button in the post form. However, nstead of using a normal input[type=submit], use the following: <button type=”button” name=”button-name” id=’button-id’>Button Text</button>’ A click won’t process as a … Read more

Problem uploading different files as custom fields with front end post form

For starters, the ‘post_category’ argument only accepts category ID’s, so you will have to find that through your database, or through get_category_by_slug: $cat = get_category_by_slug( ‘music’ ); $cat_id = $cat->term_id; Secondly, look at your wp_handle_upload() section. You are passing $file[‘file’] in both cases, where ‘file’ is not the name of either of your upload fields. … Read more

Front end post form validation

Using isset isn’t the best option, because when you submit the form the post variables will still be set, just to null. You should check if the values are null. Also you are echoing the validation error messages, when you should be assigning them to a variable and returning the variable, then outputting the returned … Read more

Page Options Saving But Not Updating In Backend

If the page is manually refreshed then the right content shows up, it’s so weird! I am pretty sure this is the problem, and its not that weird. If you update with AJAX (in your case with jQuery/Javascript) the generated page– the page in the browser– is not going to reflect any changes unless your … Read more

Making a form for user to add new custom post with custom taxonomies and custom fields

To list the options for a custom taxonomy you need to query the taxonomy terms. To do that you use get_terms() http://codex.wordpress.org/Function_Reference/get_terms // We are assuming color is the name of the taxonomy $colors = get_terms( ‘color’, array( ‘orderby’ => ‘name’, ‘hide_empty’ => 0 )); // Now loop through the colors and spit out the … Read more