{"id":6365,"date":"2016-02-24T15:49:59","date_gmt":"2016-02-24T20:49:59","guid":{"rendered":"https:\/\/themespress.ca\/?p=6365"},"modified":"2022-09-11T10:47:29","modified_gmt":"2022-09-11T14:47:29","slug":"sort-post-types-by-popularity","status":"publish","type":"post","link":"https:\/\/themespress.ca\/en\/sort-post-types-by-popularity\/","title":{"rendered":"Sort Post Types by Popularity"},"content":{"rendered":"<div class=\"wpb-content-wrapper\"><div class=\"vc_row wpb_row vc_row-fluid\"><div class=\"wpb_column vc_column_container vc_col-sm-12\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\">\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>With this tutorial, we will help you sort your post types by their popularity. First thing we need to do is a meta post (views) which will all you go get each post type&#8217;s number of views.<\/p>\n<p>We will call it via_views_count which will the meta key to get with our query.<\/p>\n\n\t\t<\/div>\n\t<\/div>\n<div id=\"ts-enlighterjs-container-4017086\" class=\"ts-enlighterjs-container-single-enabled  \" style=\"width: 100%;  margin-top: 0px; margin-bottom: 0px;\" data-enlighter-doubleclick=\"true\" data-enlighter-windowbutton=\"true\" data-enlighter-windowtext=\"New Window\" data-enlighter-rawbutton=\"true\" data-enlighter-rawtext=\"RAW Code\" data-enlighter-infobutton=\"false\" data-enlighter-infotext=\"EnlighterJS\" data-enlighter-indent=\"2\"><pre id=\"ts-enlighterjs-pre-4017086\" class=\"\" style=\"white-space: pre-wrap; height: 100%; margin: 0; padding: 0;\" data-enlighter-language=\"php\" data-enlighter-theme=\"enlighter\" data-enlighter-group=\"\" data-enlighter-title=\"\" data-enlighter-linenumbers=\"true\" data-enlighter-lineoffset=\"1\" data-enlighter-highlight=\"\">\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\/\/ Popular Posts By views for Posts\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\nfunction via_post_views($postID) {\n$count_key = &#039;via_views_count&#039;;\n$count = get_post_meta($postID, $count_key, true);\nif($count==&#039;&#039;){\n$count = 0;\ndelete_post_meta($postID, $count_key);\nadd_post_meta($postID, $count_key, &#039;0&#039;);\n}else{\n$count++;\nupdate_post_meta($postID, $count_key, $count);\n}}\n\/\/To keep the count accurate, lets get rid of prefetching\nremove_action( &#039;wp_head&#039;, &#039;adjacent_posts_rel_link_wp_head&#039;, 10, 0);\n\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\/\/ Tracks Views\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\nfunction via_track_post_views ($post_id) {\nif ( !is_single() ) return;\nif ( empty ( $post_id) ) {\n\tglobal $post;\n$post_id = $post-&gt;ID;    \n}\nvia_post_views($post_id);}\nadd_action( &#039;wp_head&#039;, &#039;via_track_post_views&#039;);\n\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\/\/ Get Posts Views\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\nfunction via_get_post_views($postID){\n$count_key = &#039;via_views_count&#039;;\n$count = get_post_meta($postID, $count_key, true);\nif($count==&#039;&#039;){\ndelete_post_meta($postID, $count_key);\nadd_post_meta($postID, $count_key, &#039;0&#039;);\nreturn &quot;0 Vue&quot;;\n}\nreturn $count.&#039; Vues&#039;;\n}\n<\/pre><\/div>\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>We will create the Views column displayed in the post table which will return each post&#8217;s views.<\/p>\n\n\t\t<\/div>\n\t<\/div>\n<div id=\"ts-enlighterjs-container-6219451\" class=\"ts-enlighterjs-container-single-enabled  \" style=\"width: 100%;  margin-top: 0px; margin-bottom: 0px;\" data-enlighter-doubleclick=\"true\" data-enlighter-windowbutton=\"true\" data-enlighter-windowtext=\"New Window\" data-enlighter-rawbutton=\"true\" data-enlighter-rawtext=\"RAW Code\" data-enlighter-infobutton=\"false\" data-enlighter-infotext=\"EnlighterJS\" data-enlighter-indent=\"2\"><pre id=\"ts-enlighterjs-pre-6219451\" class=\"\" style=\"white-space: pre-wrap; height: 100%; margin: 0; padding: 0;\" data-enlighter-language=\"php\" data-enlighter-theme=\"enlighter\" data-enlighter-group=\"\" data-enlighter-title=\"\" data-enlighter-linenumbers=\"true\" data-enlighter-lineoffset=\"1\" data-enlighter-highlight=\"\">\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\/\/ Admin Columns display posts Views\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\nadd_filter(&#039;manage_posts_columns&#039;, &#039;via_column_views&#039;);\nadd_action(&#039;manage_posts_custom_column&#039;, &#039;via_custom_column_views&#039;,5,2);\nfunction via_column_views($defaults){\n    $defaults[&#039;via_post_views&#039;] = __(&#039;Vues&#039;);\n    return $defaults;\n}\nfunction via_custom_column_views($column_name, $id){\n        if($column_name === &#039;via_post_views&#039;){\n        echo via_get_post_views(get_the_ID());\n    }\n}<\/pre><\/div><h2 style=\"text-align: left\" class=\"vc_custom_heading vc_do_custom_heading\" >Sort Post Types by Popularity<\/h2>\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>Here&#8217;s the query to use to sort your post types by popularity.<\/p>\n<p>You can use your HTML to display the results. In this tutorial, it&#8217;s only an hyperlink.<\/p>\n<p>Replace <strong>post<\/strong> by the name of your <strong>Post Type<\/strong>.<\/p>\n\n\t\t<\/div>\n\t<\/div>\n<div id=\"ts-enlighterjs-container-3194238\" class=\"ts-enlighterjs-container-single-enabled  \" style=\"width: 100%;  margin-top: 0px; margin-bottom: 0px;\" data-enlighter-doubleclick=\"true\" data-enlighter-windowbutton=\"true\" data-enlighter-windowtext=\"New Window\" data-enlighter-rawbutton=\"true\" data-enlighter-rawtext=\"RAW Code\" data-enlighter-infobutton=\"false\" data-enlighter-infotext=\"EnlighterJS\" data-enlighter-indent=\"2\"><pre id=\"ts-enlighterjs-pre-3194238\" class=\"\" style=\"white-space: pre-wrap; height: 100%; margin: 0; padding: 0;\" data-enlighter-language=\"php\" data-enlighter-theme=\"enlighter\" data-enlighter-group=\"\" data-enlighter-title=\"\" data-enlighter-linenumbers=\"true\" data-enlighter-lineoffset=\"1\" data-enlighter-highlight=\"\">&lt;?php \n$popularpost = new WP_Query( \narray( \n&#039;post_type&#039;                 =&gt; &#039;post&#039;, \n&#039;post_status&#039;               =&gt; &#039;publish&#039;, \n&#039;posts_per_page&#039;            =&gt; 9, \n&#039;meta_key&#039;                  =&gt; &#039;via_views_count&#039;, \n&#039;orderby&#039;                   =&gt; &#039;meta_value_num&#039;, \n&#039;order&#039;                     =&gt; &#039;DESC&#039; ) ); \nwhile ( $popularpost-&gt;have_posts() ) : $popularpost-&gt;the_post(); \n?&gt;\n&lt;?php the_title();?&gt;\n&lt;?php endwhile; ?&gt;\t\n&lt;?php wp_reset_query(); ?&gt;<\/pre><\/div>\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p><a class=\"more\" href=\"https:\/\/codex.wordpress.org\/Function_Reference\/add_post_meta\" target=\"_blank\" rel=\"noopener\">Learn more about add_post_meta<\/a><\/p>\n\n\t\t<\/div>\n\t<\/div>\n<\/div><\/div><\/div><\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"With this tutorial, we will help you sort your post types by their popularity. First thing we need to do is a meta post (views) which will all you go<div class=\"read-more\"><a class=\"btn button-secondary\" href=\"https:\/\/themespress.ca\/en\/sort-post-types-by-popularity\/\">Read More<\/a><\/div>","protected":false},"author":81,"featured_media":4507,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[283],"tags":[322],"class_list":["post-6365","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-query"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"Share the post &quot;Sort Post Types by Popularity&quot; Facebook LinkedIn Twitter Partager... E-mail Ajouter aux favoris Bluesky With this tutorial, we will help you sort your post types by their popularity. First thing we need to do is a meta post (views) which will all you go get each post type\u2019s number of views. We\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Daniel\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/themespress.ca\/en\/sort-post-types-by-popularity\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Themespress - Des tutoriels et ressources WordPress\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Sort Post Types by Popularity - Themespress\" \/>\n\t\t<meta property=\"og:description\" content=\"Share the post &quot;Sort Post Types by Popularity&quot; Facebook LinkedIn Twitter Partager... E-mail Ajouter aux favoris Bluesky With this tutorial, we will help you sort your post types by their popularity. First thing we need to do is a meta post (views) which will all you go get each post type\u2019s number of views. We\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/themespress.ca\/en\/sort-post-types-by-popularity\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2016-02-24T20:49:59-05:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2022-09-11T14:47:29-04:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Sort Post Types by Popularity - Themespress\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Share the post &quot;Sort Post Types by Popularity&quot; Facebook LinkedIn Twitter Partager... E-mail Ajouter aux favoris Bluesky With this tutorial, we will help you sort your post types by their popularity. First thing we need to do is a meta post (views) which will all you go get each post type\u2019s number of views. We\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/sort-post-types-by-popularity\\\/#blogposting\",\"name\":\"Sort Post Types by Popularity - Themespress\",\"headline\":\"Sort Post Types by Popularity\",\"author\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/author\\\/daniel\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/themespress.ca\\\/wp-content\\\/uploads\\\/2017\\\/02\\\/wsi-imageoptim-asdfasf-e1456334709796.jpg\",\"width\":940,\"height\":384},\"datePublished\":\"2016-02-24T15:49:59-05:00\",\"dateModified\":\"2022-09-11T10:47:29-04:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/sort-post-types-by-popularity\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/sort-post-types-by-popularity\\\/#webpage\"},\"articleSection\":\"Tutorials, Query\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/sort-post-types-by-popularity\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#listItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\\\/\\\/themespress.ca\\\/en\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/categorie\\\/tutorials\\\/#listItem\",\"name\":\"Tutorials\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/categorie\\\/tutorials\\\/#listItem\",\"position\":2,\"name\":\"Tutorials\",\"item\":\"https:\\\/\\\/themespress.ca\\\/en\\\/categorie\\\/tutorials\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/sort-post-types-by-popularity\\\/#listItem\",\"name\":\"Sort Post Types by Popularity\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#listItem\",\"name\":\"Accueil\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/sort-post-types-by-popularity\\\/#listItem\",\"position\":3,\"name\":\"Sort Post Types by Popularity\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/categorie\\\/tutorials\\\/#listItem\",\"name\":\"Tutorials\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#organization\",\"name\":\"Themespress\",\"description\":\"Des tutoriels et ressources WordPress\",\"url\":\"https:\\\/\\\/themespress.ca\\\/en\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/author\\\/daniel\\\/#author\",\"url\":\"https:\\\/\\\/themespress.ca\\\/en\\\/author\\\/daniel\\\/\",\"name\":\"Daniel\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/sort-post-types-by-popularity\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/93cd2188e40b3289d305e88acb676eb8b84078e50e06f4eb38a0152903b34c9d?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Daniel\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/sort-post-types-by-popularity\\\/#webpage\",\"url\":\"https:\\\/\\\/themespress.ca\\\/en\\\/sort-post-types-by-popularity\\\/\",\"name\":\"Sort Post Types by Popularity - Themespress\",\"description\":\"Share the post \\\"Sort Post Types by Popularity\\\" Facebook LinkedIn Twitter Partager... E-mail Ajouter aux favoris Bluesky With this tutorial, we will help you sort your post types by their popularity. First thing we need to do is a meta post (views) which will all you go get each post type\\u2019s number of views. We\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/sort-post-types-by-popularity\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/author\\\/daniel\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/author\\\/daniel\\\/#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/themespress.ca\\\/wp-content\\\/uploads\\\/2017\\\/02\\\/wsi-imageoptim-asdfasf-e1456334709796.jpg\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/sort-post-types-by-popularity\\\/#mainImage\",\"width\":940,\"height\":384},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/sort-post-types-by-popularity\\\/#mainImage\"},\"datePublished\":\"2016-02-24T15:49:59-05:00\",\"dateModified\":\"2022-09-11T10:47:29-04:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/themespress.ca\\\/en\\\/\",\"name\":\"Themespress\",\"description\":\"Des tutoriels et ressources WordPress\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Sort Post Types by Popularity - Themespress","description":"Share the post \"Sort Post Types by Popularity\" Facebook LinkedIn Twitter Partager... E-mail Ajouter aux favoris Bluesky With this tutorial, we will help you sort your post types by their popularity. First thing we need to do is a meta post (views) which will all you go get each post type\u2019s number of views. We","canonical_url":"https:\/\/themespress.ca\/en\/sort-post-types-by-popularity\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/themespress.ca\/en\/sort-post-types-by-popularity\/#blogposting","name":"Sort Post Types by Popularity - Themespress","headline":"Sort Post Types by Popularity","author":{"@id":"https:\/\/themespress.ca\/en\/author\/daniel\/#author"},"publisher":{"@id":"https:\/\/themespress.ca\/en\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/themespress.ca\/wp-content\/uploads\/2017\/02\/wsi-imageoptim-asdfasf-e1456334709796.jpg","width":940,"height":384},"datePublished":"2016-02-24T15:49:59-05:00","dateModified":"2022-09-11T10:47:29-04:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/themespress.ca\/en\/sort-post-types-by-popularity\/#webpage"},"isPartOf":{"@id":"https:\/\/themespress.ca\/en\/sort-post-types-by-popularity\/#webpage"},"articleSection":"Tutorials, Query"},{"@type":"BreadcrumbList","@id":"https:\/\/themespress.ca\/en\/sort-post-types-by-popularity\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/#listItem","position":1,"name":"Accueil","item":"https:\/\/themespress.ca\/en\/","nextItem":{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/categorie\/tutorials\/#listItem","name":"Tutorials"}},{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/categorie\/tutorials\/#listItem","position":2,"name":"Tutorials","item":"https:\/\/themespress.ca\/en\/categorie\/tutorials\/","nextItem":{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/sort-post-types-by-popularity\/#listItem","name":"Sort Post Types by Popularity"},"previousItem":{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/#listItem","name":"Accueil"}},{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/sort-post-types-by-popularity\/#listItem","position":3,"name":"Sort Post Types by Popularity","previousItem":{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/categorie\/tutorials\/#listItem","name":"Tutorials"}}]},{"@type":"Organization","@id":"https:\/\/themespress.ca\/en\/#organization","name":"Themespress","description":"Des tutoriels et ressources WordPress","url":"https:\/\/themespress.ca\/en\/"},{"@type":"Person","@id":"https:\/\/themespress.ca\/en\/author\/daniel\/#author","url":"https:\/\/themespress.ca\/en\/author\/daniel\/","name":"Daniel","image":{"@type":"ImageObject","@id":"https:\/\/themespress.ca\/en\/sort-post-types-by-popularity\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/93cd2188e40b3289d305e88acb676eb8b84078e50e06f4eb38a0152903b34c9d?s=96&d=mm&r=g","width":96,"height":96,"caption":"Daniel"}},{"@type":"WebPage","@id":"https:\/\/themespress.ca\/en\/sort-post-types-by-popularity\/#webpage","url":"https:\/\/themespress.ca\/en\/sort-post-types-by-popularity\/","name":"Sort Post Types by Popularity - Themespress","description":"Share the post \"Sort Post Types by Popularity\" Facebook LinkedIn Twitter Partager... E-mail Ajouter aux favoris Bluesky With this tutorial, we will help you sort your post types by their popularity. First thing we need to do is a meta post (views) which will all you go get each post type\u2019s number of views. We","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/themespress.ca\/en\/#website"},"breadcrumb":{"@id":"https:\/\/themespress.ca\/en\/sort-post-types-by-popularity\/#breadcrumblist"},"author":{"@id":"https:\/\/themespress.ca\/en\/author\/daniel\/#author"},"creator":{"@id":"https:\/\/themespress.ca\/en\/author\/daniel\/#author"},"image":{"@type":"ImageObject","url":"https:\/\/themespress.ca\/wp-content\/uploads\/2017\/02\/wsi-imageoptim-asdfasf-e1456334709796.jpg","@id":"https:\/\/themespress.ca\/en\/sort-post-types-by-popularity\/#mainImage","width":940,"height":384},"primaryImageOfPage":{"@id":"https:\/\/themespress.ca\/en\/sort-post-types-by-popularity\/#mainImage"},"datePublished":"2016-02-24T15:49:59-05:00","dateModified":"2022-09-11T10:47:29-04:00"},{"@type":"WebSite","@id":"https:\/\/themespress.ca\/en\/#website","url":"https:\/\/themespress.ca\/en\/","name":"Themespress","description":"Des tutoriels et ressources WordPress","inLanguage":"en-US","publisher":{"@id":"https:\/\/themespress.ca\/en\/#organization"}}]},"og:locale":"en_US","og:site_name":"Themespress - Des tutoriels et ressources WordPress","og:type":"article","og:title":"Sort Post Types by Popularity - Themespress","og:description":"Share the post &quot;Sort Post Types by Popularity&quot; Facebook LinkedIn Twitter Partager... E-mail Ajouter aux favoris Bluesky With this tutorial, we will help you sort your post types by their popularity. First thing we need to do is a meta post (views) which will all you go get each post type\u2019s number of views. We","og:url":"https:\/\/themespress.ca\/en\/sort-post-types-by-popularity\/","article:published_time":"2016-02-24T20:49:59-05:00","article:modified_time":"2022-09-11T14:47:29-04:00","twitter:card":"summary","twitter:title":"Sort Post Types by Popularity - Themespress","twitter:description":"Share the post &quot;Sort Post Types by Popularity&quot; Facebook LinkedIn Twitter Partager... E-mail Ajouter aux favoris Bluesky With this tutorial, we will help you sort your post types by their popularity. First thing we need to do is a meta post (views) which will all you go get each post type\u2019s number of views. We"},"aioseo_meta_data":{"post_id":"6365","title":null,"description":null,"keywords":[],"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":[],"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[],"defaultGraph":"Article","defaultPostTypeGraph":""},"schema_type":"default","schema_type_options":"{\"article\":{\"articleType\":\"BlogPosting\"},\"course\":{\"name\":\"\",\"description\":\"\",\"provider\":\"\"},\"faq\":{\"pages\":[]},\"product\":{\"reviews\":[]},\"recipe\":{\"ingredients\":[],\"instructions\":[],\"keywords\":[]},\"software\":{\"reviews\":[],\"operatingSystems\":[]},\"webPage\":{\"webPageType\":\"WebPage\"},\"blockGraphs\":[]}","pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2022-09-11 14:40:59","updated":"2025-06-08 02:09:05","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/themespress.ca\/en\/\" title=\"Accueil\">Accueil<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/themespress.ca\/en\/categorie\/tutorials\/\" title=\"Tutorials\">Tutorials<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tSort Post Types by Popularity\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Accueil","link":"https:\/\/themespress.ca\/en\/"},{"label":"Tutorials","link":"https:\/\/themespress.ca\/en\/categorie\/tutorials\/"},{"label":"Sort Post Types by Popularity","link":"https:\/\/themespress.ca\/en\/sort-post-types-by-popularity\/"}],"_links":{"self":[{"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/posts\/6365","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/users\/81"}],"replies":[{"embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/comments?post=6365"}],"version-history":[{"count":0,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/posts\/6365\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/media\/4507"}],"wp:attachment":[{"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/media?parent=6365"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/categories?post=6365"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/tags?post=6365"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}