Saving custom profile fields

Ok, I was doing it wrong, here’s a working solution, based on Justin Tadlock’s tutorial. <?php /* Add custom profile fields (call in theme : echo $curauth->fieldname;) */ add_action( ‘show_user_profile’, ‘my_show_extra_profile_fields’ ); add_action( ‘edit_user_profile’, ‘my_show_extra_profile_fields’ ); function my_show_extra_profile_fields( $user ) { ?> <?php if(user_can($user->ID, “paying_member”)) : ?> <h3>Extra profile information</h3> <table class=”form-table”> <tr> <th><label for=”paypal_account”>Paypal</label></th> … Read more

Force hide custom field metaboxes

http://codex.wordpress.org/Function_Reference/remove_meta_box function remove_custom_meta_form() { remove_meta_box( ‘postcustom’, ‘post’, ‘normal’ ); remove_meta_box( ‘postcustom’, ‘page’, ‘normal’ ); } add_action( ‘admin_menu’ , ‘remove_custom_meta_form’ ); HTH

Customize permalink when creating a post

This can be done using the wp_insert_post_data hook. function house_post_slug( $data ) { if ( $data[‘post_type’] == ‘houses’ ) { $permalink = ”; if ( isset ( $_POST[‘ACF Code Field’] ) ) { $permalink = $_POST[‘ACF Code Field’]; } if ( isset ( $_POST[‘post_title’] ) ) { $permalink .= ‘-‘ . $_POST[‘post_title’]; } $data[‘post_name’] = … Read more

meta query not showing any results?

you’re missing an array within the meta_query element: $args = array( ‘post_type’ => ‘programmes’, ‘meta_query’ => array( array( ‘key’ => ‘linktovideocatchup’, ‘value’ => ”, ‘compare’ => ‘NOT LIKE’ ) ) ); (this is required to allow for querying of multiple meta fields.) you also had an extraneous comma after the meta_query array element which can … Read more

Make URL in custom field hyper link

Use this. get_post_meta($post->ID, ‘custom-field-name’, true); Where custom-field-name is the name of the custom field. You will have to add your custom field name in place of custom-field-name. Also to open link in new browser window/tab add target=”_blank”. Always use esc_url() for URLs and esc_html() when you want to display a value without working HTML. $value … Read more