{"id":12810305,"date":"2020-05-10T12:29:36","date_gmt":"2020-05-10T12:29:36","guid":{"rendered":"https:\/\/wordpress.org\/support\/?post_type=topic&#038;p=12810305"},"modified":"2020-05-10T12:44:18","modified_gmt":"2020-05-10T12:44:18","slug":"how-to-return-in-wordpress-function-php-file","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/how-to-return-in-wordpress-function-php-file\/","title":{"rendered":"How to Return in WordPress Function php file?"},"content":{"rendered":"<p>The code is:<\/p>\n<pre><code>function my_custom_function( $html, $content ) {\n\n$html .=  get_post_field(&#039;post_content&#039;, $post_id);\n\nreturn $html;\n}\n\n$priority = 10;\n\nadd_filter( &#039;tps_the_content_after&#039;, &#039;my_custom_function&#039;, $priority, 2 );<\/code><\/pre>\n<p>If my content is &#8220;this is my content&#8221;, then the code return &#8220;this is my content&#8221;<\/p>\n<p>I want to add <code>&lt;div&gt;<\/code> before the content, but I don&#8217;t know how to write the code, it should return like this<\/p>\n<p><code>&quot;&lt;div class=&quot;post&quot;&gt;this is my content&lt;\/div&gt;&quot;<\/code><br \/>\nThank you!<\/p>\n","protected":false},"template":"","class_list":["post-12810305","topic","type-topic","status-publish","hentry","topic-tag-function","topic-tag-php"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/12810305","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":1,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/12810305\/revisions"}],"predecessor-version":[{"id":12810359,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/12810305\/revisions\/12810359"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=12810305"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}