{"id":6746234,"date":"2015-11-13T13:42:17","date_gmt":"2015-11-13T13:42:17","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/adding-custom-code-2\/"},"modified":"2016-08-30T20:14:23","modified_gmt":"2016-08-30T20:14:23","slug":"adding-custom-code-2","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/adding-custom-code-2\/","title":{"rendered":"Adding custom code"},"content":{"rendered":"<p>Hi, i need your help with inserting your code into another one through a function\/filter<\/p>\n<p>this is the code so far, it displays fine but it cannot retrieve the color set in category options<\/p>\n<pre><code>\/\/ Category option checked\n        if ($instance[&#039;stats_tag&#039;][&#039;category&#039;]) {\n\t\t\t\t\t\t$rl_category_color = rl_color($category-&gt;cat_ID);\n            $post_cat = get_the_category($popular-&gt;id);\n            $post_cat = (isset($post_cat[0]))\n\n\t\t\t\t\t\t\t? &#039;&lt;a class=&quot;reddish&quot; href=&quot;&#039;.get_category_link($post_cat[0]-&gt;term_id).&#039;&quot;style=&quot;background-color:&#039;.$rl_category_color.&#039;;&quot;&gt;&#039;.$post_cat[0]-&gt;cat_name.&#039;&lt;\/a&gt;&#039;\n              : &#039;&#039;;\n\n            if ($post_cat != &#039;&#039;) {\n                $stats[] = &#039;&lt;span class=&quot;wpp-category&quot;&gt;&#039; . sprintf(__(&#039;under %s&#039;, &#039;wordpress-popular-posts&#039;), $post_cat) . &#039;&lt;\/span&gt;&#039;;\n            }\n\n        }<\/code><\/pre>\n<p>Obviously it missing something or perhaps has some incorrect code, would you help figure it out?<\/p>\n<p>My web page that I&#8217;m working on is http:\/\/www.creativitynest.com\/home<\/p>\n<p>https:\/\/wordpress.org\/plugins\/category-color\/<\/p>\n","protected":false},"template":"","class_list":["post-6746234","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/6746234","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\/6746234\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=6746234"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}