Posted By : Date : fanuzzi | 04-03-2021
To edit the Admin header of your new post type page you need to add the following code: Hook add_action(‘admin_head-edit.php‘,’edit_change_title_function’); The edit function in your function you have to check if the post type is the one you need, and then apply a filter for the title function edit_change_title_function(){ global$post; if($post->post_type == 'posttype_name') { add_filter('the_title','posttype_title_function',100,2); } } So, you can override the title getting the value from db: function posttype_title_function($title, $post_id) { $new_title = get_post_meta($post_id,'slb_first_name',true) .' '.get_post_meta($post_id,'slb_last_name',true); return $new_title; }
Read More
0 Comments
WordPress Custom Post Type
Posted By : Date : fanuzzi | 04-02-2021
Post types are a way to categorize different types of content in WordPress. Wordpress has already the following native post type: Post Pages Attachments Revisions Navigation menu custom CSS Changeset Most probably you just knew about the first three in the list. And you can extend these wordpress post type with your own. To do this you here it is a little function recap. Hook custom post type definition Hook add_action( 'init', 'custom_posttype_def', 0 ); custom post type definition function custom_posttype_def() { // Set UI labels for Custom Post Type…
Read More
0 Comments