Function.php can not be applied.

Posted in: Newspaper
Post count: 24

Hi,
My function.php (Child-Theme) can not be applied.
What am I missing?

<?php
/* —————————————————————————-
Newspaper V6.3+ Child theme – Please do not use this child theme with older versions of Newspaper Theme

What can be overwritten via the child theme:
– everything from /parts folder
– all the loops (loop.php loop-single-1.php) etc
– please read the child theme documentation: https://forum.tagdiv.com/the-child-theme-support-tutorial/

– the rest of the theme has to be modified via the theme api:
https://forum.tagdiv.com/the-theme-api/

*/

add_action(‘init’,’add_categories_for_pages’);
function add_categories_for_pages(){
register_taxonomy_for_object_type(‘category’, ‘page’);
}
add_action( ‘pre_get_posts’, ‘nobita_merge_page_categories_at_category_archive’ );
function nobita_merge_page_categories_at_category_archive( $query ) {
if ( $query->is_category== true && $query->is_main_query() ) {
$query->set(‘post_type’, array( ‘post’, ‘page’, ‘nav_menu_item’));
}
}

function custom_wp_tag_cloud($args) {
$myargs = array(
‘orderby’ => ‘count’, //使用頻度順
‘order’ => ‘DESC’, // 降順(使用頻度の高い順)
‘number’ => 40 // 表示数
);
$args = wp_parse_args($args, $myargs);
return $args;
}
add_filter( ‘widget_tag_cloud_args’, ‘custom_wp_tag_cloud’ );

// 固定ページにタグを設定
function add_tag_to_page() {
register_taxonomy_for_object_type(‘post_tag’, ‘page’);
}
add_action(‘init’, ‘add_tag_to_page’);
// タグアーカイブに固定ページを含める
function add_page_to_tag_archive( $obj ) {
if ( is_tag() ) {
$obj->query_vars[‘post_type’] = array( ‘post’, ‘page’ );
}
}
add_action( ‘pre_get_posts’, ‘add_page_to_tag_archive’ );

add_theme_support(‘post-thumbnails’);

/* —————————————————————————-
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’, ”, TD_THEME_VERSION, ‘all’ );
wp_enqueue_style(‘td-theme-child’, get_stylesheet_directory_uri() . ‘/style.css’, array(‘td-theme’), TD_THEME_VERSION . ‘c’, ‘all’ );

?>

Post count: 22421

Hello,

First please test your code in the main functions.php file and see if the code work properly. If it does, then please read this guide:
https://code.tutsplus.com/tutorials/a-guide-to-overriding-parent-theme-functions-in-your-child-theme–cms-22623

Thank you!

Viewing 2 posts - 1 through 2 (of 2 total)
The forum ‘Newspaper’ is closed to new topics and replies.