- NewspaperChild Theme Support
Thanks for the reply.. i found the following information from the plugin author …
Add related posts automatically after the post content by using a code snippet in your (child) theme’s functions.php file
add_filter( ‘the_content’, ‘add_related_posts_after_post_content’ );
function add_related_posts_after_post_content( $content ) {//check if it’s a single post page.
if ( is_single() ) {// check if we’re inside the main loop
if ( in_the_loop() && is_main_query() ) {// add your own attributes here (between the brackets [ … ])
$shortcode = ‘[related_posts_by_tax posts_per_page=”4″]’;// add the shortcode after the content
$content = $content . $shortcode;
}
}return $content;
}
in our theme,can we put the code in the function.php directly ??
latest version from functions.php .. why are some lines without url and yet reported in PageSpeed Insights?
registered scripts
archivesCW | http://www.cele.si/second/wp-content/plugins/archives-calendar-widget/jquery.archivesCW.min.js
aspexi-facebook-like-box | http://www.cele.si/second/wp-content/plugins/aspexi-facebook-like-box/js/aflb.js
jquery | http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js
td-site-min | http://www.cele.si/second/wp-content/themes/Newsmag/js/tagdiv_theme.min.js
comment-reply | /wp-includes/js/comment-reply.min.js
registered styles
ual-style-css |
archives-cal-classiclight |
awesome-weather |
opensans-googlefont |
google_font_roboto_cond |
google-fonts-style |
td-theme |
td-theme-child |
-
This reply was modified 11 years by
gregy1403.
I think I am part way there.
With the help of the example in the API documentation, I have code for the new thumbnail, block and module, and have put what I thought was the correct code in the td_api_plugin.php (links to all code below)
1) The new block initially appeared in the visual composer but when used, and I tried to view the page, it gave a 404 error.
2) I directly edited td_page_builder_widgets.php to include the new block. The new block initially showed in the widgets but when used in a sidebar there were NO images on the page (the featured image also disappeared).
I didn’t know if I should reactivate the plugin after changes so tried to do so and now consistently get the following, and the widget of the new block is no longer available in the list:
wp booster error:
td_api_base::mark_used_on_page : a component with the ID: jc_block_7 is not set.
/homepages/8/d453795254/htdocs/SiteHome/wp-content/themes/Newspaper/includes/wp_booster/td_wp_booster_functions.php
Links to code:
https://dl.dropboxusercontent.com/u/4800576/TagDiv%20questions/jc_block_7.php
https://dl.dropboxusercontent.com/u/4800576/TagDiv%20questions/jc_module_6.php
https://dl.dropboxusercontent.com/u/4800576/TagDiv%20questions/td-api-plugin.php
I would really like to see where this code is wrong please to help my general understanding, but I have found an alternative solution for this particular need.
td_block_21 also uses square images but in the theme is not in the widgets list. Having now found the way to get blocks in the list I put the block 21 in there and works great. I assume I cannot edit this file via the API or child theme? A direct edit is not ideal even though it is a simple one.
Thanks
Hi,
How can I create a child theme for Newspaper? Do I ned to add functions.php, footer.php, header.php tot he child theme?
Regards
OK great,
A bit new to this but I moved this code into my functions.php in my child theme, changed the number and it didnt work.
// Number of product per page 6
add_filter(‘loop_shop_per_page’, create_function(‘$cols’, ‘return 15;’));
if (!function_exists(‘woocommerce_output_related_products’)) {
// Number of related products
function woocommerce_output_related_products() {
woocommerce_related_products(array(
‘posts_per_page’ => 3,
‘columns’ => 3,
‘orderby’ => ‘rand’,
)); // Display 3 products in rows of 1
}
}
My question is, how do i change this without it not changing in a future update. Do I have to move the whole of the functions.php into the childtheme folder? If I did would your future updates still work?
V.444 update to V.6
-Deleted “themes/Newspaper”
-Uploaded “/Newspaper”
-Updated included plugins
-Clear Cache
Fatal error: Call to undefined function vc_column_offset_class_merge() in /nas/wp/www/staging/moderntips/wp-content/themes/Newspaper/vc_templates/vc_column.php on line 22
Any help would be very appreciated, I have been slamming my head off the wall trying to get this thing updated.
Happy to apply any tests.
Also Warnings
Warning: include(/nas/wp/www/staging/moderntips/wp-content/themes/Newspaper/includes/td_wordpres_booster.php): failed to open stream: No such file or directory in /nas/wp/www/staging/moderntips/wp-content/themes/Newspaper-child/functions.php on line 9
Warning: include(): Failed opening ‘/nas/wp/www/staging/moderntips/wp-content/themes/Newspaper/includes/td_wordpres_booster.php’ for inclusion (include_path=’.:/usr/share/php:/usr/share/pear’) in /nas/wp/www/staging/moderntips/wp-content/themes/Newspaper-child/functions.php on line 9
Hi, I’m going to update the theme to version 2.0. I’ve noticed that you made changes to child theme CSS and functions.php. Should we modify them? Their changes are not listed in the changelog.
Also, what if the name of the parent theme directory is different from “Newsmag”? It’ll detect the parent theme automatically via what it’s set on wordpress?
Thanks!
Hi!
Something is wrong with my functions.php, it seems that I have broken it.
After trying to apply some changes on a child theme I stopped seeing the “Mewspaper” button on the admin page. I decided then revert all the changes on my child theme’s functions.php but the result was the same. I decided then to go to the original zip folder with the theme that I downloaded from Themeforest and copy the file functions.php and paste it on the same place on the server.
I thought this would solve the problem but it did not. The site is blocked, all I see is a blank page and not even the url shows me something…
The backups I have are way too old, a lot has happened since then. Does anyone have any suggestion to solve this? Thanks in advance!
Here is my functions.php:
<?php
/* ----------------------------------------------------------------------------
WordPress booster framework - this is our theme framework - all the content and settings are there
It is not necessary to include it in the child theme only if you want to use the API
*/
if (!defined('TD_THEME_WP_BOOSTER')) {
include TEMPLATEPATH . '/includes/td_wordpres_booster.php';
}
// Adds a widget area.
if (function_exists('register_sidebar')) {
register_sidebar(array(
'name' => 'Annonser i toppen',
'id' => 'extra-widget-area',
'description' => 'Annonser i toppen - redigeras hos Widgets Builder',
'before_widget' => '<div class="td-header-top-menu-full">',
'after_widget' => '</div>',
'before_title' => '<h2>',
'after_title' => '</h2>'
));
}
// Place the widget area after the header
add_action ('__before_header', 'add_my_widget_area', 10);
function add_my_widget_area() {
if (function_exists('dynamic_sidebar')) {
dynamic_sidebar('Extra Header Widget Area');
}
}
// Visual editor always on
add_filter( 'wp_default_editor', 'force_default_editor' );
function force_default_editor() {
//allowed: tinymce, html, test
return 'tinymce';
}
?>
Hi,
You can use do_shortcode function to place a custom ad in header.php file that it ca be overwritten by child theme – http://screencast.com/t/tfSHbmlm and paste your code in Theme Panel > Ads – Custom ad – http://screencast.com/t/Ai0jnyHcOkh
<?php echo do_shortcode('[td_block_ad_box spot_id="custom_ad_1"]');?>
You customize it using custom css in Theme Panel > Custom Css – http://screencast.com/t/82VwxRmtg
Or if you want to register a new sidebar you can do this in functions.php from child theme – http://screencast.com/t/vrZ2ti3WJx – http://screencast.com/t/oVcC46g3DO
<?php dynamic_sidebar('extra'); ?>
register_sidebar(array(
'name'=> 'extra',
'id' => 'extra-widget', //the id is used by the importer
'before_widget' => '<aside class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<div class="block-title"><span>',
'after_title' => '</span></div>'
));
And place the sidebar in header.php like I suggested above with custom ad – http://screencast.com/t/E2EVTuZAHut it should work fine – http://screencast.com/t/Qg6RwbYoxA4r
<?php dynamic_sidebar('extra'); ?>
Thanks!
-
This reply was modified 11 years by
Alin [tagDiv].
-
This reply was modified 11 years by
Alin [tagDiv].
-
This reply was modified 11 years by
Alin [tagDiv].
-
This reply was modified 11 years by
Alin [tagDiv].
/*CHRISTOPHER's CUSTOM MODS - slim version */
remove_action( 'wp_head', 'wp_generator' ) ;
remove_action( 'wp_head', 'wlwmanifest_link' ) ;
remove_action( 'wp_head', 'rsd_link' ) ;
remove_action( 'wp_head', 'feed_links', 2 );
remove_action( 'wp_head', 'feed_links_extra', 3 );
remove_action('wp_head','print_emoji_detection_script',7);
remove_action('wp_print_styles','print_emoji_styles');
function no_errors_please(){
return 'You appear to be up to no good. Please stop now!';}
add_filter( 'login_errors', 'no_errors_please' );
function remove_cssjs_ver( $src ) {
if( strpos( $src, '?ver=' ) )
$src = remove_query_arg( 'ver', $src );
return $src;
}
add_filter( 'style_loader_src', 'remove_cssjs_ver', 10, 2 );
add_filter( 'script_loader_src', 'remove_cssjs_ver', 10, 2 );
add_filter( 'jpeg_quality', create_function( '', 'return 50;' ) );
This is the combined block of code (including the emoji removal mentioned above) that goes at the END of the functions.php file.
@neotrope Not sure why you said that code can’t go into the child theme. I’m running the child theme and inserted this into the functions.php file inside the child theme directory and it’s working spectacularly. Do you mind elaborating on why you emphasized that so much?
Thanks for codes @neotrope and @fudoki
Same. I try to use old child theme, but got error functions.php blah blah blah.
Please provide child theme for Newspaper 6.
Thank you
I have tried to make an authors page using the authors block, been looking at this post for the solution -> https://forum.tagdiv.com/topic/author-box-help/
It works fine when i insert this in the main themes td_block_author.php
$buffy .= '<div class="td-authors-description desc">';
$buffy .= '<p>' . get_the_author_meta( "description", $td_author->ID ) . '</p>';
$buffy .= '</div>';
But im trying to make it work from my child theme instead. I have added this to my child functions.php
function hook_td_global_after() {
td_api_block::update('td_block_authors',
array(
'map_in_visual_composer' => true,
"name" => 'Block Authors',
"base" => 'td_block_authors',
"class" => 'td_block_authors',
"controls" => "full",
"category" => 'Blocks',
'icon' => 'icon-pagebuilder-td_block_authors',
'file' => td_global::$get_template_directory . '/includes/shortcodes/td_block_authors.php',
"params" => array_merge(
td_wp_booster_config::get_map_block_general_array(),
td_wp_booster_config::get_map_filter_array(),
td_wp_booster_config::get_map_block_ajax_filter_array(),
td_wp_booster_config::get_map_block_pagination_array()
)
)
);
}
But it doesn’t work. Its probably me whos to tired to figure it out, but i dont get it. :/
Hi, I am wondering it is possible to use wordpress hooks (actions or filters) to programmatically set the Post Template for a specific category?
My intention is to make it harder for the editors of my site to ‘break’ the layout designs I want to keep consistent on the site.
Not sure if it is possible, but it would be great if through the functions.php in the child theme, you could set the $td_post_theme_settings[‘td_post_template’]; to a template of your own choosing.
Thanks in advance!
Always delete/clear cache before updates.
Always delete old theme folder and child theme folder for new theme; upload new folders to completely replace old ones. Delete old plugins completely, install new folders. NEVER OVER-WRITE UPDATES.
Always clear cache after making changes to core files when they are working; otherwise you are loading mix of old/new from server and things break.
If you’re unable to do anything — try switching to default theme, try disabling all plugins entirely; try resetting the plugins folder (see my “how to move to new theme” for a best practice way to update/upgrade and recover from fail).
Only put stuff at end of your functions.php in MAIN folder, NOT child theme. Only add things you know what they are — most being self-evident. If site crashes when loading edited functions.php, then roll back to your backup. If site won’t recover from that, then it’s 100% a caching problem.
Often for testing via FTP, I do
a) all caching and mod_pagespeed disabled
b) rename functions.php to xfunctions.php
c) drag over new functions.php
d) test site
e) if site won’t load; via ftp with window still open, just rename xfunctions.php to functions.php and it replaces the bad functions.php — total time 20-30 seconds.
Not sure any of that helps, but maybe some pointers in some direction.
For those using Newspaper 6 you may want to use the “slim” version of my suggested functions.php tweaks. Note this goes at END of file; make sure you edit only in a plain text editor and NOT MS Word; make sure you turn your caching OFF before changing any major files like this. Always keep backup. With caching off, switching back is as simple as uploading your original. If on Linux, make sure your text editor saves a Linux/unix “line breaks” and not “PC/windows line breaks.”
/*CHRISTOPHER's CUSTOM MODS - slim version */
remove_action( 'wp_head', 'wp_generator' ) ;
remove_action( 'wp_head', 'wlwmanifest_link' ) ;
remove_action( 'wp_head', 'rsd_link' ) ;
remove_action( 'wp_head', 'feed_links', 2 );
remove_action( 'wp_head', 'feed_links_extra', 3 );
function no_errors_please(){
return 'You appear to be up to no good. Please stop now!';}
add_filter( 'login_errors', 'no_errors_please' );
function remove_cssjs_ver( $src ) {
if( strpos( $src, '?ver=' ) )
$src = remove_query_arg( 'ver', $src );
return $src;
}
add_filter( 'style_loader_src', 'remove_cssjs_ver', 10, 2 );
add_filter( 'script_loader_src', 'remove_cssjs_ver', 10, 2 );
add_filter( 'jpeg_quality', create_function( '', 'return 50;' ) );
This is intended for those using the main theme, not a child theme; meaning you need to add this to the main functions.php in your main theme folder **NOT CHILD THEME FOLDER**.
-
This reply was modified 11 years by
simchris.
Hello,
we’re using the new td_category_template_8.php style for our category headers as we like the layout/styling, but for some reason it’s showing all categories in this area if the current category doesn’t have any children.
Is it possible to override this file in our child theme or add something to our functions.php file to stop the theme showing the category list?
Thanks, James
See @batman post (https://forum.tagdiv.com/topic/big-grid-1-and-2-problems-on-newspaper-6-and-6-1/#post-55067) which pushes the priority of enqueuing of the theme style to the bottom of the pile. Copied here for those of you following this thread:
Open up the functions.php from the child theme and add 1000 priority to the wp_enqueue_scripts action:
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles', 1000);
Hopefully the tagdiv team will plug this hole shortly.
Hello fellow crime fighters,
Open up the functions.php from the child theme and add 1000 priority to the wp_enqueue_scripts action:
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles', 1000);
I am afraid to say that this time the answer completely ignored my question before the code 🙂
What you say is what I have done already, but I want to know if I can do it without hacking the core.
If I simply copy these lines into my child functions.php it gives me an error, and I would like to know if there is a solution to overwrite it from my child-theme?
Take off one more time, maybe in the second attempt you’ll save me again :))
Hi,
Please edit the functions.php file from Child-theme and add like here: http://screencast.com/t/yN9NzaOd
Thanks! We will fix this in the next update.
1) If we add the line
@import url(“../Newspaper/style.css”);
at the style.css of the child theme
2) if we edit the functions.php file in the child theme and remove the lines
/* —————————————————————————-
add the parent style + style.css from this folder
*/
add_action( ‘wp_enqueue_scripts’, ‘theme_enqueue_styles’ );
function theme_enqueue_styles() {
wp_enqueue_style(‘td-theme’, get_template_directory_uri() . ‘/style.css’, ”, ‘6c’, ‘all’ );
wp_enqueue_style(‘td-theme-child’, get_stylesheet_directory_uri() . ‘/style.css’, array(‘td-theme’));
}
then the child theme works ok with BigGrid… I don’t know if thats ok to do….
-
This reply was modified 11 years by
neakriti.
1. How do I erase the excess pink space from the top of footer to snap closer to logo and same with bottom of footer to snap closer to social icons?
I think those areas have some padding due to the possibility to include some ads in those spaces. It looks like the height of the footer is hardcoded to be 1164×389. It is element ‘td-footer-wrapper td-footer-template-4’. You could change it in your style sheet.
2. How do I make the social icons in footer menu a bit bigger? And how do I make the hover colour on those icons a solid purple colour instead of the colours constantly changing?
The footer social media icons are designed to be 40×40. You’d have to change the styles too. Look at the following elements in your CSS: td-social-style-2 and td-icon-font. If you’re going to make several edits to the stylesheet, consider making a child theme.
3. Chris’s Pagespeed Custom Code no longer works (the one that you post at the end of the functions.php – will he be coming out with a new one that works with Newspaper 6?)
Have you upgraded to v6.1 of the theme?
4. How do I move the bottom share options (at the end of my posts), above my taboola advertisement so that they appear right at end of article?
Go to your dashboard. Theme Panel>Post Seetings>Sharing. You should see toggles to move the social sharing buttons.
5. Is there a code so that my custom ad 1 will appear underneath (or above) the author box?
I’m not sure if it always inserts it below ads. I think the author box is placed there via the posts template. You can attempt to mess with the posts templates to see if another one places the author box higher. Go to dashboard. Theme Panel>Post Settings>Default Post Template.
Hello,
I want the 1068×580 version to be cropped center center, not top as it is by default.
I found this in includes/td_config.php
So here i can change it, BUT i would like to avoid a core hack of course.
How can I overwrite this in the functions.php of my child-theme?
(I am unfamiliar with this whole td_api thing. In the old version I see it was solved in the “traditional” way with add_image_size();, but this is here is overcoming my knowledge 🙂
td_api_thumb::add('td_1068x580',
array(
'name' => 'td_1068x580',
'width' => 1068,
'height' => 580,
'crop' => array('center', 'top'),
'post_format_icon_size' => 'normal',
'used_on' => array(
'Slide - 3 column'
)
)
Hi,
You have to check the API documentation here: – https://forum.tagdiv.com/the-theme-api/ – https://forum.tagdiv.com/the-child-theme-method/
An example for block 1 template file would be:
<?php
/* ----------------------------------------------------------------------------
WordPress booster framework - this is our theme framework - all the content and settings are there
It is not necessary to include it in the child theme only if you want to use the API
*/
if (!defined('TD_THEME_WP_BOOSTER')) {
include TEMPLATEPATH . '/includes/td_config.php';
include TEMPLATEPATH . '/includes/wp_booster/td_wp_booster_functions.php';
}
add_action('td_global_after', 'hook_td_global_after'); // hook used to add or modify items via Api
function hook_td_global_after() {
td_api_block::update_key('td_block_1', 'file', get_stylesheet_directory() . '/includes/shortcodes/td_block_1.php');
}
Thank you!
-
This reply was modified 11 years by
Emil G.