load custom fields on click

I don’t know if you’ve found an answer on this question yet since it’s from 2011 but I have an idea on how to retrieve the data. What if you created a VERY simple php file that took the post ID as a get variable and displayed the post’s custom fields? It would look something … Read more

Not sure why wp_ajax isn’t working?

This is just a simple javascript issue. When your javascript that attaches the click behavior to the form is parsed, the form element doesn’t yet exist because it’s further down the page, so it doesn’t get attached. Either move the javascript below the form, wrap it in a jQuery(document).ready(), or use live. EDIT – $(‘#ajaxForms’).serialize(); … Read more

Using AJAX in wordpress theme

You need to add the $where parameter to your update statement because it doesn’t know which row to update. The $wpdb->update() method has no default value for the $where argument so you must supply one. http://codex.wordpress.org/Class_Reference/wpdb#UPDATE_rows Try this: $wpdb->update( $wpdb->wp_frm_items, array( ‘alerts’ => 1), array( ‘user’ => get_current_user_id() ) );

include wp-blog-header not working on MAMP

You’re making something completely wrong. Header comment In your main file, you need the following comment on top (ex. taken from Contact form 7): <?php /* Plugin Name: Contact Form 7 Plugin URI: http://contactform7.com/ Description: Just another contact form plugin. Simple but flexible. Author: Takayuki Miyoshi Author URI: http://ideasilo.wordpress.com/ Text Domain: wpcf7 Domain Path: /languages/ … Read more

slideshow is not showing in a post call with ajax

When you load a page that contains a normal static post, there is some JavaScript that is called on page load to instantiate your slider. Something like: jQuery(document).ready(function($){ $(‘.sliders’).someSliderScript(); }); This finds all of the elements that should have a slider applied and runs all the necessary code to set it up and make it … Read more

Convert this relative path to absolute

As long as your wp-admin directory is still at the root of your site, you can just add a forward slash (/) to the URI. Alterntaively, you can use wp_localize_script() to pass in your site’s URL or, if you are using WordPress’s AJAX functions, the ajaxurl JS variable. var ajaxPath=”/wp-admin/admin-ajax.php”; Or <?php wp_enqueue_script( ‘some_handle’ ); … Read more

How to get a value from PHP in Jquery through Ajax

You are passing ‘readen_color’ as the action parameter, but you’ve defined the ajax action as ‘mark_as_read’. Try this: $.post(ajaxurl, { action:’mark_as_read’, post_id: iPostId }, function (response) { console.log(response); }); And as for your PHP: add_action( ‘wp_ajax_mark_as_read’, array( &$this, ‘readen_color’ ) ); // Add no_priv if you want users not logged in to be able to … Read more