Retrieving values of custom fields in Quick Edit mode

Ok, I got it, here’s the code: function ilc_quickedit_save($post_id, $post) { if( $post->post_type != ‘evento’ ) return; if (isset($_POST[‘is_quickedit’])) update_post_meta($post_id, ‘eventdate’, $_POST[‘eventdate’]); } function ilc_quickedit_get() { $html=”<script type=”text/javascript”>”; $html .= ‘jQuery(document).ready(function() {‘; $html .= ‘jQuery(“a.editinline”).live(“click”, function() {‘; $html .= ‘var id = inlineEditPost.getId(this);’; $html .= ‘jQuery.post(“‘ . THEME_URI . ‘/library/admin/admin.php”,{ post_id: id, modo: “ajaxget” },’; … Read more

adding custom fields to next and previous post link

Here’s the code for what you’re trying to do (accessing post custom value): <?php global $post; $prev_post = get_adjacent_post(); $next_post = get_adjacent_post( false, ”, false ); $prev_post_id = $prev_post->ID; $next_post_id = $next_post->ID; // this should, according to your code above, be the http://example.com/your/img.jpg string $prev_img_path = get_post_custom_values( ‘your_key_name’, $prev_post_id ); $next_img_path = get_post_custom_values( ‘your_key_name’, $next_post_id … Read more

How to hook get_terms() to only show count of posts that have custom meta

As far as I remember counts for terms are stored in database, so there is nothing to modify when you fetch them – you simply get ready-made numbers. So you will either need to implement and maintain your special logic for counts completely separately or try to recalculate and modify native counts, see wp_update_term_count_now().

Custom fields are not restored to previous revisions

Post revisions are for the fields in the posts database table and not the postmeta database table. So if you want to create your own postmeta revision you could save the meta when the revision is made using _wp_put_post_revision and you can restore the meta using wp_restore_post_revision.

How I check if the same post slug has not been used before publishing?

The Ajax way (a little bit dirty, but you can easily enhance it) In your functions.php (or in a plugin, or every where else) : function my_ajax_update(){ if (isset($_POST[‘title’])){ global $wpdb; $title = esc_sql($_POST[‘title’]); if(!$title) return; $page = $wpdb->get_results(” SELECT * FROM $wpdb->posts WHERE post_title LIKE ‘$title’ AND post_type=”event” AND post_status=”publish” LIMIT 1 “); if … Read more

add custom fields to the post on admin side

To insert your own custom field after the title field you will have to invoke the hook edit_form_after_title. You may at the following to your plugin or theme: add_action(‘edit_form_after_title’, function() { global $post; print ‘<input type=”text” name=”post_title” size=”30″ tabindex=”1″ value=”‘.esc_attr( htmlspecialchars( $post->post_title ) ).'” id=”title” autocomplete=”off” />’; }); Note: the default title field will stop … Read more

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