Enable Page, Post and Attachment via Child Theme
-
I am using the parent theme deCente and by default page comments are turned off. I found a comments.php file in the parent theme’s lib/framework folder. I want to remove the parent theme comments feature via my child theme and then put code in the child theme functions.php file to allow override the parent theme’s comment function’s TRUE/FALSE.
What code is required in the child theme’s functions.php file to accomplish this?
Here is the code that enables/disables the comments in parent theme:
add_action( 'frameshift_post_content_after', 'frameshift_get_comments_template', 100 ); function frameshift_get_comments_template() { $args = array( 'comments_posts' => true, 'comments_pages' => false, 'comments_attachments' => false ); $args = apply_filters( 'frameshift_get_comments_template_args', $args ); // Extract $args extract( $args, EXTR_SKIP ); if ( is_single() && ! is_attachment() && $comments_posts == true ) { comments_template( '', true ); } elseif ( is_page() && $comments_pages == true && ! is_page_template( 'page-tpl-blog.php' ) ) { comments_template( '', true ); } elseif ( is_attachment() && $comments_attachments == true ) { comments_template( '', true ); } }
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Enable Page, Post and Attachment via Child Theme’ is closed to new replies.