{"id":87,"date":"2019-07-23T09:47:07","date_gmt":"2019-07-23T09:47:07","guid":{"rendered":"http:\/\/chamankumar.co.uk\/blog\/?p=87"},"modified":"2019-08-05T12:03:33","modified_gmt":"2019-08-05T12:03:33","slug":"news-custom-post-type","status":"publish","type":"post","link":"https:\/\/chamankumar.co.uk\/blog\/wordpress\/news-custom-post-type","title":{"rendered":"News custom post type"},"content":{"rendered":"<p><code>\/\/ News custom post type<br \/>\nfunction cw_post_type_news() {<\/p>\n<p>\t$supports = array(<br \/>\n\t'title', \/\/ post title<br \/>\n\t'editor', \/\/ post content<br \/>\n\t'author', \/\/ post author<br \/>\n\t'thumbnail', \/\/ featured images<br \/>\n\t'excerpt', \/\/ post excerpt<br \/>\n\t'custom-fields', \/\/ custom fields<br \/>\n\t\/\/'comments', \/\/ post comments<br \/>\n\t'revisions', \/\/ post revisions<br \/>\n\t\/\/'post-formats', \/\/ post formats<br \/>\n\t);<\/p>\n<p>\t$labels = array(<br \/>\n\t'name' => _x('News', 'plural'),<br \/>\n\t'singular_name' => _x('News', 'singular'),<br \/>\n\t'menu_name' => _x('News', 'admin menu'),<br \/>\n\t'name_admin_bar' => _x('News', 'admin bar'),<br \/>\n\t'add_new' => _x('Add new', 'add new'),<br \/>\n\t'add_new_item' => __('Add new News'),<br \/>\n\t'new_item' => __('New News'),<br \/>\n\t'edit_item' => __('Edit News'),<br \/>\n\t'view_item' => __('View News'),<br \/>\n\t'all_items' => __('All News'),<br \/>\n\t'search_items' => __('Search News'),<br \/>\n\t'not_found' => __('No news found.'),<br \/>\n\t);<\/p>\n<p>\t$args = array(<br \/>\n\t'supports' => $supports,<br \/>\n\t'labels' => $labels,<br \/>\n\t'public' => true,<br \/>\n\t'query_var' => true,<br \/>\n\t'rewrite' => array('with_front' => false, 'slug' => 'information\/media\/in-the-press'), \/\/ with_front=false do not use same slug as blog<br \/>\n\t'has_archive' => true,<br \/>\n\t'hierarchical' => false,<br \/>\n\t);<br \/>\n\tregister_post_type('news', $args);<br \/>\n}<br \/>\nadd_action('init', 'cw_post_type_news');<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\/\/ News custom post type function cw_post_type_news() { $supports = array( &#8216;title&#8217;, \/\/ post title &#8216;editor&#8217;, \/\/ post content &#8216;author&#8217;, \/\/ post author &#8216;thumbnail&#8217;, \/\/ featured images &#8216;excerpt&#8217;, \/\/ post excerpt &#8216;custom-fields&#8217;, \/\/ custom fields \/\/&#8217;comments&#8217;, \/\/ post comments &#8216;revisions&#8217;, \/\/ post revisions \/\/&#8217;post-formats&#8217;, \/\/ post formats ); $labels = array( &#8216;name&#8217; => _x(&#8216;News&#8217;, &#8216;plural&#8217;), [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[10,8],"tags":[],"_links":{"self":[{"href":"https:\/\/chamankumar.co.uk\/blog\/wp-json\/wp\/v2\/posts\/87"}],"collection":[{"href":"https:\/\/chamankumar.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chamankumar.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chamankumar.co.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chamankumar.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=87"}],"version-history":[{"count":2,"href":"https:\/\/chamankumar.co.uk\/blog\/wp-json\/wp\/v2\/posts\/87\/revisions"}],"predecessor-version":[{"id":98,"href":"https:\/\/chamankumar.co.uk\/blog\/wp-json\/wp\/v2\/posts\/87\/revisions\/98"}],"wp:attachment":[{"href":"https:\/\/chamankumar.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=87"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chamankumar.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=87"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chamankumar.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=87"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}