{"id":3606,"date":"2019-08-05T15:56:00","date_gmt":"2019-08-05T15:56:00","guid":{"rendered":"https:\/\/purelysupp.com\/wordpress\/?p=3606"},"modified":"2022-10-16T13:10:24","modified_gmt":"2022-10-16T13:10:24","slug":"add-sort-order-to-woocommerce-page-attributes","status":"publish","type":"post","link":"https:\/\/purelysupp.com\/wordpress\/code-snippets\/add-sort-order-to-woocommerce-page-attributes\/","title":{"rendered":"Add Sort Order to WooCommerce Page Attributes"},"content":{"rendered":"\n<p>Add the following code to your theme\u2019s function.php file, or a functionality plugin to add Sort Order to WooCommerce Page Attributes.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/** Sort products by menu order ********\/\n\nfunction be_products_query( $query ) {\n\tif( $query-&gt;is_main_query() &amp;&amp; !is_admin() &amp;&amp; ( is_post_type_archive( 'products' ) || is_tax( array( 'products_category', 'products_tag' ) ) ) ) {\n                $query-&gt;set( 'posts_per_page', '25' );\n\t\t$query-&gt;set( 'orderby', 'menu_order' );\n\t\t$query-&gt;set( 'order', 'ASC' );\n\t}\n}\nadd_action( 'pre_get_posts', 'be_products_query' );<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Add the following code to your theme\u2019s function.php file, or a functionality plugin to add Sort Order to WooCommerce Page Attributes.<\/p>\n","protected":false},"author":1,"featured_media":3547,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","iawp_total_views":2,"wds_primary_category":56,"footnotes":""},"categories":[56],"tags":[205,204],"class_list":{"0":"post-3606","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-code-snippets","8":"tag-page-attributes","9":"tag-woocommerce","10":"entry"},"featured_image_src":"https:\/\/purelysupp.com\/wordpress\/wp-content\/uploads\/sites\/2\/2018\/09\/code-snippits-600x400.jpg","featured_image_src_square":"https:\/\/purelysupp.com\/wordpress\/wp-content\/uploads\/sites\/2\/2018\/09\/code-snippits-600x515.jpg","author_info":{"display_name":"Jack Alltrade","author_link":"https:\/\/purelysupp.com\/wordpress\/author\/jacka11trade\/"},"_links":{"self":[{"href":"https:\/\/purelysupp.com\/wordpress\/wp-json\/wp\/v2\/posts\/3606","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/purelysupp.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/purelysupp.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/purelysupp.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/purelysupp.com\/wordpress\/wp-json\/wp\/v2\/comments?post=3606"}],"version-history":[{"count":3,"href":"https:\/\/purelysupp.com\/wordpress\/wp-json\/wp\/v2\/posts\/3606\/revisions"}],"predecessor-version":[{"id":10657,"href":"https:\/\/purelysupp.com\/wordpress\/wp-json\/wp\/v2\/posts\/3606\/revisions\/10657"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/purelysupp.com\/wordpress\/wp-json\/wp\/v2\/media\/3547"}],"wp:attachment":[{"href":"https:\/\/purelysupp.com\/wordpress\/wp-json\/wp\/v2\/media?parent=3606"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/purelysupp.com\/wordpress\/wp-json\/wp\/v2\/categories?post=3606"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/purelysupp.com\/wordpress\/wp-json\/wp\/v2\/tags?post=3606"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}