Add code to function.php
-
Hey,
I’m trying to add some code the the function.php of my child theme, but I’m not sure how to do it the right way as everytime I try, the website crashes.
I believe this code previously worked when I wasn’t using a child theme. I only noticed the other day that the custom code was removed during an update, so that’s why I now want to add it to the child theme’s function.php
I want to hide a category so I add:
action set_category_widget_parameters($args) {
$args[‘exclude’] = ‘154’;
return $args;
}
add_filter(‘widget_categories_args’,’set_category_widget_parameters’);This is the function.php of the child theme:
<?php
/* —————————————————————————-
Newspaper 7 Child theme – Please do not use this child theme with older versions of Newspaper ThemeWhat can be overwritten via the child theme:
– everything from /parts folder
– all the loops (loop.php loop-single-1.php) etc– the rest of the theme has to be modified via the theme api:
https://forum.tagdiv.com/the-theme-api/*/
/* —————————————————————————-
add the parent style + style.css from this folder
*/
add_action( ‘wp_enqueue_scripts’, ‘theme_enqueue_styles’, 1001);
function theme_enqueue_styles() {
wp_enqueue_style(‘td-theme’, get_template_directory_uri() . ‘/style.css’, ”, ‘6.1c’, ‘all’ );
wp_enqueue_style(‘td-theme-child’, get_stylesheet_directory_uri() . ‘/style.css’, array(‘td-theme’), ‘6.1c’, ‘all’ );}
Where do I add it or is there something wrong with the code?
Thanks!
- The topic ‘Add code to function.php’ is closed to new replies.