{"id":6000061,"date":"2015-04-10T07:28:25","date_gmt":"2015-04-10T07:28:25","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/custom-fields-162\/"},"modified":"2016-08-24T14:36:30","modified_gmt":"2016-08-24T14:36:30","slug":"custom-fields-162","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/custom-fields-162\/","title":{"rendered":"Custom fields"},"content":{"rendered":"<p>While it hasn&#8217;t been updated in a while and isn&#8217;t actively maintained, it seems a lot better than the alternatives I&#8217;ve tried like Shortcoder.<\/p>\n<p>Unfortunately unlike Shortcoder, Buckets doesn&#8217;t have support for custom variables.<\/p>\n<p>I added the following two lines to the <code>buckets_shortcode<\/code> function in <code>buckets.php<\/code> to add support for custom variables (line 343):<\/p>\n<pre><code>foreach ($arg as $key =&gt; $value)\n\t$return = str_replace(&quot;%%$key%%&quot;, $value, $return);<\/code><\/pre>\n<p>This allows shortcodes to be called like <code>[bucket id=&quot;1234&quot; title=&quot;My Bucket&quot; myvar=&quot;myvalue&quot;]<\/code>. Inside buckets you can use <code>%%myvar%%<\/code> to access the custom variable.<\/p>\n<p>https:\/\/wordpress.org\/plugins\/buckets\/<\/p>\n","protected":false},"template":"","class_list":["post-6000061","topic","type-topic","status-closed","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/6000061","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/6000061\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=6000061"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}