Custom contact form 7 select with custom values [closed]

You can set the values with the filter wpcf7_form_tag and add the shortcode attributes with the filter shortcode_atts_wpcf7 add_filter(“wpcf7_form_tag”, function($scanned_tag, $replace){ if (“press_post” === $scanned_tag[“name”]) { $contact_form = WPCF7_ContactForm::get_current(); $number_of_posts = $contact_form->shortcode_attr(“number_of_posts”); $post_type = $contact_form->shortcode_attr(“post_type”); // using $number_of_posts and $post_type here $scanned_tag[‘raw_values’] = [ “number_of_posts \”$number_of_posts\” – post_type \”$post_type\” | val 1″, “Test 2|val 2”, … Read more

Query on custom field count?

The following code allows you to add the parameters wpse4528_key and wpse4528_minimum to your queries, and will then add an extra criterium to the where clause that counts the number of meta values with your key. add_filter( ‘posts_where’, ‘wpse4528_posts_where’, 10, 2 ); function wpse4528_posts_where( $where, &$wp_query ) { global $wpdb; $count_key = $wp_query->get( ‘wpse4528_key’ ); … Read more

How to show custom field’s value under post/page title in wp-admin

Just like you add new columns you render the title filed your self add_action( ‘manage_posts_custom_column’, ‘admin_post_data_row’, 10, 2); function admin_post_data_row($column_name, $post_id) { switch($column_name){ case ‘title’: edit_post_link(get_post_title($post_id), ‘<p>’, ‘</p>’,$post_id); echo ‘<br />’.get_post_meta($post_id,’field_name’,true); break; default: break; } } and if you have another plugin cancels this then simply set the filter hook priority to something bigger.

custom field with total count of Facebook likes, comments and shares

I’ve done it, here is the complete code: function insert_facebook_likes_custom_field($post_ID) { global $wpdb; if (!wp_is_post_revision($post_ID)) { add_post_meta($post_ID, ‘likes_count’, ‘0’, true); } } add_action(‘publish_page’, ‘insert_facebook_likes_custom_field’); add_action(‘publish_post’, ‘insert_facebook_likes_custom_field’); function update_facebook_likes($content=””) { global $wp_query; $permalink = get_permalink(); $idpost = $wp_query->post->ID; $data = file_get_contents(‘http://graph.facebook.com/?id=’.$permalink); $json = $data; $obj = json_decode($json); $like_no = $obj->{‘shares’}; $meta_values = get_post_meta($idpost, ‘likes_count’, true); if … Read more

ajax jquery update custom field meta value front end

First, you need to output a response in your my_action_callback() function. That response will be available inside your jQuery success callback: function(response){}. At that point it is just a matter of updating the HTML of the page with the new views count. PHP: function my_action_callback() { // … echo $views; exit; } JavaScript: jQuery.post(ajaxurl, data, … Read more

Multiple custom fields with the same name

Yes, it’s possible to have multiple fields with the same key. When using get_post_meta($post_id, $key, $single), make sure you set the $single parameter to false (or just leave it off since it defaults to false). get_post_meta( $post->ID, ‘Event Promotion’, false ) or get_post_meta( $post->ID, ‘Event Promotion’ ) This will return an array containing every value … Read more

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