{"id":86883,"date":"2018-06-13T05:58:21","date_gmt":"2018-06-13T05:58:21","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/deniz-primary-category\/"},"modified":"2018-06-13T06:09:50","modified_gmt":"2018-06-13T06:09:50","slug":"deniz-primary-category","status":"publish","type":"plugin","link":"https:\/\/pap-aw.wordpress.org\/plugins\/deniz-primary-category\/","author":16197497,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.0","stable_tag":"trunk","tested":"","requires":"4.5","requires_php":"","requires_plugins":"","header_name":"Select Primary Category","header_author":"Deniz \u00d6zsen","header_description":"Adds the ability to designate a primary category for posts and custom post types","assets_banners_color":"","last_updated":"2018-06-13 06:09:50","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"https:\/\/developer.wordpress.org\/plugins\/deniz-primary-category\/","header_author_uri":"https:\/\/profiles.wordpress.org\/denizozsen","rating":0,"author_block_rating":0,"active_installs":0,"downloads":1197,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":[],"upgrade_notice":[],"ratings":[],"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":[],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[89,32161,91],"plugin_category":[57],"plugin_contributors":[157917],"plugin_business_model":[],"class_list":["post-86883","plugin","type-plugin","status-publish","hentry","plugin_tags-category","plugin_tags-primary","plugin_tags-taxonomy","plugin_category-taxonomy","plugin_contributors-denizozsen","plugin_committers-denizozsen"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/deniz-primary-category.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=description-->\n<p>Features:\n* Ability to designate a primary category for posts and custom post types.\n* Supports custom post types and custom taxonomies with hierarchical structure.\n* Category in permalink is the primary category, if one is set.\n* Shortcode for displaying posts with a specific primary category.\n* CLI command for listing posts with a specific primary category.<\/p>\n\n<!--section=installation-->\n<ol>\n<li>Add the plugin folder to WordPress' plugin directory.<\/li>\n<li>Activate the plugin from Admin &gt; Plugins.<\/li>\n<li>Start using it.<\/li>\n<\/ol>\n\n<!--section=faq-->\n<dl>\n<dt>Installation Instructions<\/dt>\n<dd><ol>\n<li>Add the plugin folder to WordPress' plugin directory.<\/li>\n<li>Activate the plugin from Admin &gt; Plugins.<\/li>\n<li>Start using it.<\/li>\n<\/ol><\/dd>\n<dt>When using the shortcode, do I need to use the primary category's ID, slug or name?<\/dt>\n<dd><p>You can use either of them. E.g. assuming a category with ID 3, slug 'ground-coffee' and name 'Ground Coffee'.\nthe following shortcode definitions will all work:<\/p>\n\n<pre><code>[posts_by_primary_category category=\"3\"]\n[posts_by_primary_category category=\"ground-coffee\"]\n[posts_by_primary_category category=\"Ground Coffee\"]\n<\/code><\/pre><\/dd>\n<dt>Developers' Notes<\/dt>\n<dd><p>If you want to fetch posts belonging to a particular category (or, more generally, belonging to a particular term)\nyou can use this:<\/p>\n\n<pre><code>if ( class_exists( 'SPC_Queries' ) ) {\n    \/*\n     * Let's fetch 10 published posts with primary category set to category ID 2.\n     *\/\n    $spc_queries =  SPC_Infrastructure_Container::get_instance()-&gt;get( 'SPC_Queries' );\n    $posts = $spc_queries-&gt;get_primary_term_posts( 2, array(\n        'post_status'    =&gt; 'publish',\n        'posts_per_page' =&gt; 10,\n        'post_type'      =&gt; 'post',\n    ) );\n}\n<\/code><\/pre>\n\n<p>You can just as well pass a category slug or name, instead of its ID, if you prefer.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>1.0<\/h4>\n\n<ul>\n<li>Initial public release.<\/li>\n<\/ul>","raw_excerpt":"Adds the ability to designate a primary category for posts and custom post types.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/pap-aw.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/86883","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pap-aw.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/pap-aw.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/pap-aw.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=86883"}],"author":[{"embeddable":true,"href":"https:\/\/pap-aw.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/denizozsen"}],"wp:attachment":[{"href":"https:\/\/pap-aw.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=86883"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/pap-aw.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=86883"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/pap-aw.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=86883"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/pap-aw.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=86883"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/pap-aw.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=86883"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/pap-aw.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=86883"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}