{"id":3267762,"date":"2012-12-12T22:23:03","date_gmt":"2012-12-12T22:23:03","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/feature-suggestion-5\/"},"modified":"2016-08-20T18:52:33","modified_gmt":"2016-08-20T18:52:33","slug":"feature-suggestion-5","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/feature-suggestion-5\/","title":{"rendered":"Feature Suggestion"},"content":{"rendered":"<p>Hi Johan,<br \/>\nExcellent plugin!<\/p>\n<p>I have a feature suggestion &#8211; check for a matching template part in the theme folder  before outputting\/displaying the content block. <\/p>\n<p>For example with the code below, if a user had a content block with the title About Us,<br \/>\nthey could also have a template part called block-aboutus.php in their theme folder that would handle the output:<\/p>\n<p>Add to post-widget.php, line 83<br \/>\n<code>\/\/ Look for template before default output<\/code><br \/>\n<code>$title = str_replace(array(&#039; &#039;,&#039;_&#039;,&#039;-&#039;), &#039;&#039;, strtolower($content_post-&gt;post_title) );<\/code><br \/>\n<code>if (locate_template(&quot;block-{$title}.php&quot;)) {<\/code><br \/>\n<code>echo get_template_part(&#039;block&#039;, $title);<\/code><br \/>\n<code>return;<\/code><br \/>\n<code>}<\/code><\/p>\n<p>This will allow the plugin to work really well with something like Advanced Custom Fields &#8211; You can effectively have Advanced Custom Fields (ACF) for Sidebar Widgets when used in conjunction with your plugin. Let me know your thoughts! I want to actually write a tutorial on my blog bcooling.com.au\/blog about using ACF + Custom Post Widget for this purpose.<\/p>\n<p>https:\/\/wordpress.org\/extend\/plugins\/custom-post-widget\/<\/p>\n","protected":false},"template":"","class_list":["post-3267762","topic","type-topic","status-closed","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/3267762","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\/3267762\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=3267762"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}