- NewspaperChild Theme Support
- ApiThe Theme API
Hello Guys,
We are using some custom Cloud Library templates and for our posts and coming modifications cause me a headache at the moment, because I simply get lost by all possibilities and how you can change things in the Newspaper theme. 🙂
So, let’s assume we starting with a fresh child-theme and I want to add some custom PHP Code to show up an Amazon buying box on a specific position in all posts, which is the best place to start? As we are using Cloud Library templates there are no “physical” files which I can modify and hooking up by functions.php maybe even not work as desired, that options do we have? Maybe I missed something. Could we do something with the Blocks?
I need a big nudge into the right direction. 🙂
Thanks in advance,
Chris
Hi,
I have the same problem too…
When I would like to edit page : Error at zones: 5(models) : 6(dom). The model does not match the content
In Child theme i don’t have any header.php. Only functions.php and one page.
And when i make new blank page : Error at zones: 5(models) : 6(dom). The model does not match the content
A while ago I created a child theme with the files available in the /code/ folder. In this folder was also the functions.php file with just a few lines of coding. This file is now in my child theme folder. Everything is working fine btw. When I look into the ‘regular’ functions.php file from the latest Newspaper update, I see a much bigger file with more lines of coding. Should I copy this to my child theme or can I stick to the small file which is in my child theme folder for a while now?
Thanks for your help.
I’m just building my first site with Newspaper 9.5
With my WordPress sites I don’t usually get into changes to functions.php etc.
What is the case for and against deploying a child theme?
Actually, I’ve found a solution that maybe could useful even for other users.
A simple function can be added to functions.php file, a kind of
add_action(‘wp_head’,’SOFT_manage_robots’);
function SOFT_manage_robots(){
if(is_singular(‘attachment’) )
$html= “<meta name=\”robots\” content=\”noindex,follow\”>”.PHP_EOL;
echo $html;
}
Obiouvsly it’s better to do before a child theme.
How can I create my own Category Template? For example, I am already using a Child Theme so I want to make a copy of td_category_template_8.php and create something like td_category_template_88888.php. I do not want to make changes directly in the Child Theme of td_category_template_8.php because I need it for some categories. So I wish to create an entirely new td_category_template_88888.php
Is there a way to do that? Maybe add something to functions.php?
Hi,
Please add in functions.php on child theme the below code:
add_action( 'add_meta_boxes', 'tu_remove_meta_boxes', 999 );
function tu_remove_meta_boxes() {
remove_meta_box('td_post_theme_settings_metabox', 'post', 'normal');
}
add_action('add_meta_boxes', 'remove_meta_boxes');
function remove_meta_boxes(){
remove_meta_box( 'td_post_theme_settings_metabox', 'td_book', 'normal' );
remove_meta_box( 'mymetabox_revslider_0', 'td_book', 'normal' );
}
https://www.screencast.com/t/XKpkHKmw
See results: https://www.screencast.com/t/3zafrscE
https://www.screencast.com/t/UjUfRDGCe8C
https://www.screencast.com/t/IATCCOnx
Hope this will help you.
Thanks.
I’ve found this in forum, added to functions.php on child theme, and it doesn’t work.
add_action( 'add_meta_boxes', 'tu_remove_meta_boxes', 999 );
function tu_remove_meta_boxes() {
remove_meta_box('td_post_theme_settings_metabox', 'post', 'normal');
}
I want to remove this metabox on my cpt:

And this on usual posts:

And rev slider on usual posts:

Hiding them from screen not a good option.
Thanks
I like the default pop-up modal login form of Newspaper theme. I don’t PHP much.
Could you help me what code to insert or what should I modify in the td-login-modal.php?
Or much better please provide a function code (in functions.php child).
Thanks a lot sir Simion. This will help a lot of customers also.
I use a list of categories on wordpress pages built with Tagdiv Composer, as well as on standard pages. The site uses the latest version of the theme Newspaper. The list of categories is displayed via shortcode:
function categories_list_shortcode () {
$args = array(
'show_option_all' => '',
'show_option_none' => __('No categories'),
'orderby' => 'name',
'order' => 'ASC',
'show_last_update' => 0,
'style' => 'list',
'show_count' => 0,
'hide_empty' => 1,
'use_desc_for_title' => 0,
'child_of' => 0,
'feed' => '',
'feed_type' => '',
'feed_image' => '',
'exclude' => '',
'exclude_tree' => '',
'include' => '',
'hierarchical' => 0,
'title_li' => '',
'number' => NULL,
'echo' => 0,
'depth' => 0,
'current_category' => 0,
'pad_counts' => 0,
'taxonomy' => 'category',
'walker' => 'Walker_Category'
);
$categories_list = wp_list_categories( $args );
return '<ul class="catslist">'. $categories_list . '</ul>';
}
add_shortcode('categories_list', 'categories_list_shortcode');
If there are round brackets in the category name, this category is not displayed correctly in the list (screen – http://joxi.ru/VrwbyPKu773gRA).
If I change the theme to another, then everything is displayed correctly.
I think the problem is in the filter:
/* ----------------------------------------------------------------------------
add span wrap for category number in widget
*/
add_filter('wp_list_categories', 'cat_count_span');
function cat_count_span($links) {
$links = str_replace(' (', '<span class="td-widget-no">', $links);
$links = str_replace(')', '</span>', $links);
return $links;
}
905-913 lines in /Newspaper/includes/wp_booster/td_wp_booster_functions.php
How to fix this problem?
Hello Catalin,
thank you for your reply.. this is not working
<?php echo do_shortcode (‘[td_block_1]‘); ?>
i have added the code as you said to loop-single-1.php but its not doing anything..
other option : to add the shortcode to post builder is working, but thats not the way we want to do it.
as we using childtheme is there a option to add the code
<?php echo do_shortcode (‘[td_block_1]‘); ?>
for every post using functions.php
cheers
jan
Hi,
1) I’ll try with the child theme, although it’s not entirely clear from the documentation which parts of your -child template should be replaced, e.g. in functions.php:
a) In expression ‘add the parent style + style.css from this folder’ – what exactly is a ‘parent style’ and how to add it and where?
b) what’s the difference between ‘td-theme’ and ‘TD-THEME-VERSION’? Are there any other variables that shall be replaced?
2) Re date suffix – you’re right about English suffix, however I was talking about Polish date format, which is still wrong even without using this suffix. I can’t upload screenshots, but in Polish the name of the month shall change form in dates, and for some reason in the top bar it doesn’t. For example, the name of October in Polish is ‘październik’ (and it shall be lower case, rather than capital letter, by the way). However, in dates the month shall be written in different grammar form, with -a suffix, i.e. “23 października 2018”. Instead, in the top bar it is “23 Październik 2018”, which is double wrong, firstly because of the form, and secondly because of the capital letter.
Interestingly, in posts the date shows correctly as “23 października 2018”, and it corresponds with settings in WP admin panel, so I guess this is rather up to WP coding than your theme coding.
Looked like a simple topic at first… 🙂
Hi Catalin,
I’m using a child theme with custom functions.php where the following was added in order to show 3 products per row + sidebar on desktop instead of the default 4:
function new_loop_shop_per_page( $cols ) {
// $cols contains the current number of products per page based on the value stored on Options -> Reading
// Return the number of products you wanna show per page.
$cols = 15;
return $cols;
}
// Change number or products per row to 3
add_filter(‘loop_shop_columns’, ‘loop_columns’);
if (!function_exists(‘loop_columns’)) {
function loop_columns() {
return 3; // 3 products per row
}
}
The thing is – the number of products per page on mobile also changed to 15 and so the last row on every category page contains only one product.
I followed the guide from WordPress and TagDiv, but my child theme’s stylesheet is not loading. Here are the codes I have in functions.php:
<?php
function my_theme_enqueue_styles() {
$parent_style = 'td-theme';
wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style',
get_stylesheet_directory_uri() . '/style.css',
array( $parent_style ),
wp_get_theme()->get('Version')
);
}
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
?>
I read the latest post about this issue and followed some examples, but it’s still not working.
- https://forum.tagdiv.com/search/child+theme+how+to+functions.php/
- https://forum.tagdiv.com/topic/woocommerce-single-product-page-and-shop-page/
I created a functions.php, style.css in a new directory called Newspaper-child. The style.css is blank. The functions.php has the code above. Why is it that no stylesheet loads? Doesn’t it fetch AND load the files and stylesheets from the parent template before checking the child? So even if my style.css is blank, it should work, right?
Let me know what I’m not doing right. Thank you.
Hi Simion,
Thanks, we were able to solve the issue.
One last question. We’ve updated the newspaper theme Version: 9.0.1 and we installed a child theme Newspaper 7 Child themeVersion: 7.7c
The child theme is active. The style.css sheet is not loading… tried to add some css but it doesn’t load! Also the code below is from the functions.php located in the child theme;
*/
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’ );
}
How can we make the child theme style sheet load properly ??
Thanks
Hi Simion,
Thanks a lot for your answer, it works like a charm.
However, it works if I directly change the thumbtype in td_wp_booster_functions.php of Newspaper Parent theme. I tried to inherit the file to override the default thumbtype in my Newspaper child theme, by copying/pasting the includes folder but it doesn’t work.
Is there a way to override the td_wp_booster_functions.php file in my child theme without editing it directly? I would like to do so to prevent reset by future Newspaper updates.
Thanks,
Jacques
Please read me carefully.

themeforest-5489609-newspaper.zip -> Newspaper-tf -> code -> Newspaper-child
Extract all 3 files
functions.php
screenshot.png
style.css
to a folder
wp-content/themes/Newspaper-child/
via FTP.
This folder
wp-content/themes/Newspaper-child/
on the hosting (server) you have to create manually via FTP client (like Filezilla for example).
After this activate the Child Newspaper Theme in admin-panel of your WordPress site.
Extract all 3 files
functions.php
screenshot.png
style.css
from the Themeforest archive
/code/Newspaper-child/
to a folder
wp-content/themes/Newspaper-child/
on your hosting (server) with your wordpress-site
and activate the Child Newspaper Theme in admin-panel.
That is all. Try it.
Hello,
A theme update will always replace the old files with the new ones so basically your old files will get deleted and the new ones put in their place. Your customization will be lost. Functions.php can be re-written from the child theme though:
https://code.tutsplus.com/tutorials/a-guide-to-overriding-parent-theme-functions-in-your-child-theme–cms-22623
Thank you!
Hi,
I buy theme today and this is my first comment.
Yet i have not installed theme, but i want to ask you in advance that if i want to add many codes in functions.php then which file i edit? (Theme or Child theme?)
Thanks
I already figured it out. I enabled the debug mode of WordPress and the problem was in the functions.php of the child theme. There was some strange code in there. The code doesn’t even exist in your functions.php of the child theme. After i removed the code, everything was functioning fine.
Extract all 3 files
functions.php
screenshot.png
style.css
from the Themeforest archive
/code/Newspaper-child/
to a folder
wp-content/themes/Newspaper-child/
on your hosting (server) with your wordpress-site
and activate the Child Newspaper Theme in admin-panel.
Hi there,
I am looking to display the last updated date close the articles’ date of creation. I found this code on the net (here https://www.wpbeginner.com/wp-tutorials/display-the-last-updated-date-of-your-posts-in-wordpress/) :
******************************************************
function wpb_last_updated_date( $content ) {
$u_time = get_the_time(‘U’);
$u_modified_time = get_the_modified_time(‘U’);
if ($u_modified_time >= $u_time + 86400) {
$updated_date = get_the_modified_time(‘F jS, Y’);
$updated_time = get_the_modified_time(‘h:i a’);
$custom_content .= ‘<p class=”last-updated”>Last updated on ‘. $updated_date . ‘ at ‘. $updated_time .'</p>’;
}
$custom_content .= $content;
return $custom_content;
}
add_filter( ‘the_content’, ‘wpb_last_updated_date’ );
**************************************************************
The above code is to be implemented in the functions.php main theme file.
And my question is : what would be the correct code to implement in functions.php child theme ?
Thanks in advanced :).
Hi,
You could try some suggestions from these topics
– https://wordpress.org/support/topic/sitemap-error-error-on-line-2-at-column-6-xml-declaration-allowed-only-at-the/
– https://kb.yoast.com/kb/xml-sitemap-error/
– https://premium.wpmudev.org/forums/topic/error-on-line-3-at-column-6-xml-declaration-allowed-only-at-the-start-of-the-document-below-is-a-re
They mention empty spaces in the wp-config.php or functions.php file (theme and child theme if used) check that.
For me there is no problem, default theme and plugins, and latest Yoast plugin
– https://www.screencast.com/t/nrIAfkhb
My authors want to have a hyperlink on each excerpts on the home page..
I tried with plugins, tried to edit functions.php ( I use child theme ! ) but no success.
Soon we will have multi-language magazine – and that makes this request more difficult – ‘cos “READ MORE>>>” also have to be translated…
tagdiv block 4
1
excerpt -read more link but especially on the home page – block 4, block 3
This tuto not works at the moment..:
http://www.wpbeginner.com/wp-tutorials/how-to-display-a-read-more-link-in-wordpress-excerpts/
// Changing excerpt more
function new_excerpt_more($more) {
global $post;
return ‘… <a href=”‘. g
,et_permalink($post->ID) . ‘”>’ . ‘Read More »’ . ‘‘;
}
add_filter(‘excerpt_more’, ‘new_excerpt_more’);
Could you guys give me ideas how to make it?
this would be applies to home page only:
http://www.1000wordsmagazine.com
Thx, Zoltan