{"id":7661881,"date":"2016-08-13T09:38:18","date_gmt":"2016-08-13T09:38:18","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/add-code-to-functionphp\/"},"modified":"2016-09-01T17:49:38","modified_gmt":"2016-09-01T17:49:38","slug":"add-code-to-functionphp","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/add-code-to-functionphp\/","title":{"rendered":"Add code to function.php"},"content":{"rendered":"<p>Hey,<\/p>\n<p>I&#8217;m trying to add some code the the function.php of my child theme, but I&#8217;m not sure how to do it the right way as everytime I try, the website crashes. <\/p>\n<p>I believe this code previously worked when I wasn&#8217;t using a child theme. I only noticed the other day that the custom code was removed during an update, so that&#8217;s why I now want to add it to the child theme&#8217;s function.php<\/p>\n<p>I want to hide a category so I add:<\/p>\n<blockquote>\n<p>action set_category_widget_parameters($args) {<br \/>\n$args[\u2018exclude\u2019] = \u2018154\u2019;<br \/>\nreturn $args;<br \/>\n}<br \/>\nadd_filter(\u2018widget_categories_args\u2019,\u2019set_category_widget_parameters\u2019);<\/p>\n<\/blockquote>\n<p>This is the function.php of the child theme:<\/p>\n<blockquote>\n<p>&lt;?php<br \/>\n\/*  &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n    Newspaper 7 Child theme &#8211; Please do not use this child theme with older versions of Newspaper Theme<\/p>\n<p>    What can be overwritten via the child theme:<br \/>\n     &#8211; everything from \/parts folder<br \/>\n     &#8211; all the loops (loop.php loop-single-1.php) etc<\/p>\n<p>     &#8211; the rest of the theme has to be modified via the theme api:<br \/>\n       http:\/\/forum.tagdiv.com\/the-theme-api\/<\/p>\n<p> *\/<\/p>\n<p>\/*  &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n    add the parent style + style.css from this folder<br \/>\n *\/<br \/>\nadd_action( &#8216;wp_enqueue_scripts&#8217;, &#8216;theme_enqueue_styles&#8217;, 1001);<br \/>\nfunction theme_enqueue_styles() {<br \/>\n    wp_enqueue_style(&#8216;td-theme&#8217;, get_template_directory_uri() . &#8216;\/style.css&#8217;, &#8221;, &#8216;6.1c&#8217;, &#8216;all&#8217; );<br \/>\n    wp_enqueue_style(&#8216;td-theme-child&#8217;, get_stylesheet_directory_uri() . &#8216;\/style.css&#8217;, array(&#8216;td-theme&#8217;), &#8216;6.1c&#8217;, &#8216;all&#8217; );<\/p>\n<p>}<\/p>\n<\/blockquote>\n<p>Where do I add it or is there something wrong with the code?<\/p>\n<p>Thanks!<\/p>\n","protected":false},"template":"","class_list":["post-7661881","topic","type-topic","status-publish","hentry","topic-tag-add-code","topic-tag-function-php"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/7661881","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\/7661881\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=7661881"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}