{"id":11206,"date":"2023-04-10T18:06:47","date_gmt":"2023-04-10T09:06:47","guid":{"rendered":"https:\/\/hanami-web.tokyo.jp\/blog\/?p=11206"},"modified":"2023-07-17T10:08:41","modified_gmt":"2023-07-17T01:08:41","slug":"make-the-location-field-optional-for-listings","status":"publish","type":"post","link":"https:\/\/hanami-web.tokyo.jp\/blog\/en\/microjobs\/make-the-location-field-optional-for-listings\/","title":{"rendered":"Matching site creation using WordPress [HivePress] Changing the address input field in listings (profiles) to optional"},"content":{"rendered":"<div class=\"sc\"><a href=\"https:\/\/hanami-web.tokyo.jp\/blog\/en\/how-to-hivepress-setting\/\" title=\"HivePress Explanation Table of Contents\">\r\n\t<p class=\"sc-txt01\">Our company also built a matching website using HivePress.<\/p>\r\n\t<p class=\"sc-txt01\">How to create a matching website using WordPress<\/p>\r\n\t<p class=\"sc-txt02\">HivePress Explanation Table of Contents \u2192<\/p>\r\n<\/a><\/div>\n\n\n<div class=\"sc af\"><a href=\"https:\/\/hivepress.io\/?ref=hv\" title=\"HivePress Official Website\" target=\"_blank\">\r\n\t<p class=\"sc-txt02\">HivePress official website \u2192<\/p>\r\n<\/a><\/div>\n\n\n\n<p>We will explain the code introduced in the HivePress code recipe.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 ez-toc-wrap-center counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">table of contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #000000;color:#000000\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #000000;color:#000000\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewbox=\"0 0 24 24\" version=\"1.2\" baseprofile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/hanami-web.tokyo.jp\/blog\/en\/microjobs\/make-the-location-field-optional-for-listings\/#%e3%83%aa%e3%82%b9%e3%83%86%e3%82%a3%e3%83%b3%e3%82%b0%e3%81%ae%e4%bd%8f%e6%89%80%e5%85%a5%e5%8a%9b%e3%83%95%e3%82%a3%e3%83%bc%e3%83%ab%e3%83%89%e3%82%92%e3%82%aa%e3%83%97%e3%82%b7%e3%83%a7%e3%83%b3%ef%bc%88%e4%bb%bb%e6%84%8f%e9%a0%85%e7%9b%ae%e3%81%ab%e5%a4%89%e6%9b%b4\" >Making the address field optional for listings<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/hanami-web.tokyo.jp\/blog\/en\/microjobs\/make-the-location-field-optional-for-listings\/#%e3%83%97%e3%83%ad%e3%83%95%e3%82%a3%e3%83%bc%e3%83%ab%e3%81%ae%e4%bd%8f%e6%89%80%e5%85%a5%e5%8a%9b%e3%83%95%e3%82%a3%e3%83%bc%e3%83%ab%e3%83%89%e3%82%92%e3%82%aa%e3%83%97%e3%82%b7%e3%83%a7%e3%83%b3%ef%bc%88%e4%bb%bb%e6%84%8f%e9%a0%85%e7%9b%ae%e3%81%ab%e5%a4%89%e6%9b%b4\" >Make the address field in your profile optional<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/hanami-web.tokyo.jp\/blog\/en\/microjobs\/make-the-location-field-optional-for-listings\/#functionphp%e3%81%b8%e8%bf%bd%e5%8a%a0\" >Add to function.php<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%e3%83%aa%e3%82%b9%e3%83%86%e3%82%a3%e3%83%b3%e3%82%b0%e3%81%ae%e4%bd%8f%e6%89%80%e5%85%a5%e5%8a%9b%e3%83%95%e3%82%a3%e3%83%bc%e3%83%ab%e3%83%89%e3%82%92%e3%82%aa%e3%83%97%e3%82%b7%e3%83%a7%e3%83%b3%ef%bc%88%e4%bb%bb%e6%84%8f%e9%a0%85%e7%9b%ae%e3%81%ab%e5%a4%89%e6%9b%b4\"><\/span>Making the address field optional for listings<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\nadd_filter(\n\t&#039;hivepress\/v1\/models\/listing\/attributes&#039;,\n\tfunction( $attributes ) {\n\t\tif ( isset( $attributes[&#039;location&#039;] ) ) {\n\t\t\t$attributes[&#039;location&#039;][&#039;edit_field&#039;][&#039;required&#039;] = false;\n\t\t}\n \n\t\treturn $attributes;\n\t},\n\t1000\n);<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%e3%83%97%e3%83%ad%e3%83%95%e3%82%a3%e3%83%bc%e3%83%ab%e3%81%ae%e4%bd%8f%e6%89%80%e5%85%a5%e5%8a%9b%e3%83%95%e3%82%a3%e3%83%bc%e3%83%ab%e3%83%89%e3%82%92%e3%82%aa%e3%83%97%e3%82%b7%e3%83%a7%e3%83%b3%ef%bc%88%e4%bb%bb%e6%84%8f%e9%a0%85%e7%9b%ae%e3%81%ab%e5%a4%89%e6%9b%b4\"><\/span>Make the address field in your profile optional<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\nadd_filter(\n\t&#039;hivepress\/v1\/models\/listing\/attributes&#039;,\n\tfunction( $attributes ) {\n\t\tif ( isset( $attributes[&#039;location&#039;] ) ) {\n\t\t\t$form[&#039;fields&#039;][&#039;location&#039;][&#039;required&#039;] = false;\n\t\t}\n \n\t\treturn $attributes;\n\t},\n\t1000\n);<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"functionphp%e3%81%b8%e8%bf%bd%e5%8a%a0\"><\/span>Add to function.php<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The code is added to function.php.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Create a child theme and add it to function.php<\/li>\n\n\n\n<li>Added using the code snippets plugin<\/li>\n<\/ul>\n\n\n\n<p>Please edit function.php in one of two ways.<\/p>\n\n\n\n<p>Finally, go to Settings &gt; Permalinks and click the [Update] button to reload the permalinks.<\/p>\n\n\n\n<p><a href=\"https:\/\/hanami-web.tokyo.jp\/blog\/en\/member\/php-customize\/\" title=\"\"><span style=\"text-decoration: underline;\">This blog post explains the prerequisites you need to know before editing function.php!<\/span><\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>HivePress\u306e\u30b3\u30fc\u30c9\u30ec\u30b7\u30d4\u3067\u7d39\u4ecb\u3055\u308c\u3066\u3044\u308b\u30b3\u30fc\u30c9\u3092\u89e3\u8aac\u3057\u307e\u3059\u3002 \u30ea\u30b9\u30c6\u30a3\u30f3\u30b0\u306e\u4f4f\u6240\u5165\u529b\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u30aa\u30d7\u30b7\u30e7\u30f3\uff08\u4efb\u610f\u9805\u76ee\u306b\u5909\u66f4) \u30d7\u30ed\u30d5\u30a3\u30fc\u30eb\u306e\u4f4f\u6240\u5165\u529b\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u30aa\u30d7\u30b7\u30e7\u30f3\uff08\u4efb\u610f\u9805\u76ee\u306b\u5909\u66f4) function.ph [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":11286,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"content-type":"","_uag_custom_page_level_css":"","footnotes":""},"categories":[1456],"tags":[1501],"class_list":["post-11206","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-microjobs","tag-hivepress"],"blocksy_meta":[],"aioseo_notices":[],"uagb_featured_image_src":{"full":["https:\/\/hanami-web.tokyo.jp\/blog\/wp-content\/uploads\/2023\/03\/HivePress-10-1.png",720,540,false],"thumbnail":["https:\/\/hanami-web.tokyo.jp\/blog\/wp-content\/uploads\/2023\/03\/HivePress-10-1-150x150.png",150,150,true],"medium":["https:\/\/hanami-web.tokyo.jp\/blog\/wp-content\/uploads\/2023\/03\/HivePress-10-1-300x225.png",300,225,true],"medium_large":["https:\/\/hanami-web.tokyo.jp\/blog\/wp-content\/uploads\/2023\/03\/HivePress-10-1.png",720,540,false],"large":["https:\/\/hanami-web.tokyo.jp\/blog\/wp-content\/uploads\/2023\/03\/HivePress-10-1.png",720,540,false],"1536x1536":["https:\/\/hanami-web.tokyo.jp\/blog\/wp-content\/uploads\/2023\/03\/HivePress-10-1.png",720,540,false],"2048x2048":["https:\/\/hanami-web.tokyo.jp\/blog\/wp-content\/uploads\/2023\/03\/HivePress-10-1.png",720,540,false],"trp-custom-language-flag":["https:\/\/hanami-web.tokyo.jp\/blog\/wp-content\/uploads\/2023\/03\/HivePress-10-1.png",16,12,false]},"uagb_author_info":{"display_name":"\u682a\u5f0f\u4f1a\u793eHanamiWEB \u4ee3\u8868\u53d6\u7de0\u5f79 \u677e\u6d66\u307f\u3055","author_link":"https:\/\/hanami-web.tokyo.jp\/blog\/en\/author\/hanami\/"},"uagb_comment_info":0,"uagb_excerpt":"HivePress\u306e\u30b3\u30fc\u30c9\u30ec\u30b7\u30d4\u3067\u7d39\u4ecb\u3055\u308c\u3066\u3044\u308b\u30b3\u30fc\u30c9\u3092\u89e3\u8aac\u3057\u307e\u3059\u3002 \u30ea\u30b9\u30c6\u30a3\u30f3\u30b0\u306e\u4f4f\u6240\u5165\u529b\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u30aa\u30d7\u30b7&hellip;","brizy_media":[],"_links":{"self":[{"href":"https:\/\/hanami-web.tokyo.jp\/blog\/en\/wp-json\/wp\/v2\/posts\/11206","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hanami-web.tokyo.jp\/blog\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hanami-web.tokyo.jp\/blog\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hanami-web.tokyo.jp\/blog\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hanami-web.tokyo.jp\/blog\/en\/wp-json\/wp\/v2\/comments?post=11206"}],"version-history":[{"count":0,"href":"https:\/\/hanami-web.tokyo.jp\/blog\/en\/wp-json\/wp\/v2\/posts\/11206\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hanami-web.tokyo.jp\/blog\/en\/wp-json\/wp\/v2\/media\/11286"}],"wp:attachment":[{"href":"https:\/\/hanami-web.tokyo.jp\/blog\/en\/wp-json\/wp\/v2\/media?parent=11206"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hanami-web.tokyo.jp\/blog\/en\/wp-json\/wp\/v2\/categories?post=11206"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hanami-web.tokyo.jp\/blog\/en\/wp-json\/wp\/v2\/tags?post=11206"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}