Search Results for 'child theme how to functions.php'

Results from the Forum
Bogdan B.
tagDiv Staff

Hi,
In order to use functions.php in the child theme , it will require coding skills in order to change the priority as I exemplified above. If you cannot do it, then don;t use the child theme for functions.php. Add your code in the main theme or hire a freelancer to help you insert your custom code. You can hire a developer from sites like studio.envato.com
Thank you!

mc_kot
tagDiv Member

And how to provide the higher priority to the code in the child them than the code from the main theme?

For now I added this code to the functions.php of the main theme
<?php
add_action( 'init', 'videogames', 0 ); //exit;

function videogames() {

register_taxonomy( 'lydi', 'post', array( 'hierarchical' => false, 'label' => 'ะ›ัŽะดะธ', 'query_var' => true, 'rewrite' => true ) );

register_taxonomy( 'temi', 'post', array( 'hierarchical' => false, 'label' => 'ะขะตะผั‹', 'query_var' => true, 'rewrite' => true ) );

register_taxonomy( 'strani', 'post', array( 'hierarchical' => false, 'label' => 'ะกั‚ั€ะฐะฝั‹', 'query_var' => true, 'rewrite' => true ) );

register_taxonomy( 'istochniki', 'post', array( 'hierarchical' => false, 'label' => 'ะ—ะฐั€ัƒะฑะตะถะฝั‹ะต ะธัั‚ะพั‡ะฝะธะบะธ', 'query_var' => true, 'rewrite' => true ) );

register_taxonomy( 'organizacii', 'post', array( 'hierarchical' => false, 'label' => 'ะžั€ะณะฐะฝะธะทะฐั†ะธะธ', 'query_var' => true, 'rewrite' => true ) );

register_taxonomy( 'regiony', 'post', array( 'hierarchical' => false, 'label' => 'ะ ะตะณะธะพะฝั‹', 'query_var' => true, 'rewrite' => true ) );

}

The code works perfectly, but I can’t understand how to placed it in the child theme.

Bogdan B.
tagDiv Staff

Hi,
Unfortunately function.php is a bit different when used from a child theme. It will not re-write the file in the main theme, but rather the code will apply over it. this is better detailed here: https://codex.wordpress.org/Child_Themes#Using_functions.php
Basically the code you add in the child theme’s functions.php has to have a higher priority than the code from the main theme, otherwise your code will not apply.
I hope this helps.
Thank you!

mc_kot
tagDiv Member

for the test reasons, can you please give me any code for the functions.php child theme in order to check if my child theme support works properly?

Magistar
Participant
#0

Hi there I am running Newspaper Version 6.6.3. My Installatron automatically updated Visusal Composer, but it was not loading. The website was unaffected but I wanted to adjust the frontpage.

Today I needed to change the frontpage. So I downloaded the latest newspaper package so I could re-install the visual composer manually. When I went to plugins and disabled wp bakery visual composer the website displayed error 500. Now the entire website has crashed.

Any thoughts on how to fix this?

I have root access so httpd log:

[Mon May 23 15:12:29.873142 2016] [proxy_fcgi:error] [pid 3346:tid 140512614889216] [client 83.82.170.196:59885] AH01071: Got error ‘PHP message: PHP Fatal error: Uncaught Error: Call to undefined function visual_composer() in /home/pcinside/domains/pcinside.info/public_html/wp-content/themes/Newspaper-child/functions.php:29\nStack trace:\n#0 /home/pcinside/domains/pcinside.info/public_html/wp-includes/plugin.php(525): myoverride(”)\n#1 /home/pcinside/domains/pcinside.info/public_html/wp-settings.php(393): do_action(‘init’)\n#2 /home/pcinside/domains/pcinside.info/public_html/wp-config.php(106): require_once(‘/home/pcinside/…’)\n#3 /home/pcinside/domains/pcinside.info/public_html/wp-load.php(37): require_once(‘/home/pcinside/…’)\n#4 /home/pcinside/domains/pcinside.info/public_html/wp-admin/admin-ajax.php(22): require_once(‘/home/pcinside/…’)\n#5 {main}\n thrown in /home/pcinside/domains/pcinside.info/public_html/wp-content/themes/Newspaper-child/functions.php on line 29\n’, referer: http://www.pcinside.info/wp-admin/post.php?post=31&action=edit
[Mon May 23 15:12:45.470177 2016] [proxy_fcgi:error] [pid 3346:tid 140512667338496] [client 83.82.170.196:59903] AH01071: Got error ‘PHP message: PHP Fatal error: Uncaught Error: Call to undefined function visual_composer() in /home/pcinside/domains/pcinside.info/public_html/wp-content/themes/Newspaper-child/functions.php:29\nStack trace:\n#0 /home/pcinside/domains/pcinside.info/public_html/wp-includes/plugin.php(525): myoverride(”)\n#1 /home/pcinside/domains/pcinside.info/public_html/wp-settings.php(393): do_action(‘init’)\n#2 /home/pcinside/domains/pcinside.info/public_html/wp-config.php(106): require_once(‘/home/pcinside/…’)\n#3 /home/pcinside/domains/pcinside.info/public_html/wp-load.php(37): require_once(‘/home/pcinside/…’)\n#4 /home/pcinside/domains/pcinside.info/public_html/wp-admin/admin-ajax.php(22): require_once(‘/home/pcinside/…’)\n#5 {main}\n thrown in /home/pcinside/domains/pcinside.info/public_html/wp-content/themes/Newspaper-child/functions.php on line 29\n’, referer: http://www.pcinside.info/wp-admin/post.php?post=31&action=edit
[Mon May 23 15:12:47.208747 2016] [proxy_fcgi:error] [pid 6708:tid 140512604399360] [client 83.82.170.196:59905] AH01071: Got error ‘PHP message: PHP Fatal error: Uncaught Error: Call to undefined function visual_composer() in /home/pcinside/domains/pcinside.info/public_html/wp-content/themes/Newspaper-child/functions.php:29\nStack trace:\n#0 /home/pcinside/domains/pcinside.info/public_html/wp-includes/plugin.php(525): myoverride(”)\n#1 /home/pcinside/domains/pcinside.info/public_html/wp-settings.php(393): do_action(‘init’)\n#2 /home/pcinside/domains/pcinside.info/public_html/wp-config.php(106): require_once(‘/home/pcinside/…’)\n#3 /home/pcinside/domains/pcinside.info/public_html/wp-load.php(37): require_once(‘/home/pcinside/…’)\n#4 /home/pcinside/domains/pcinside.info/public_html/wp-admin/admin.php(31): require_once(‘/home/pcinside/…’)\n#5 /home/pcinside/domains/pcinside.info/public_html/wp-admin/index.php(10): require_once(‘/home/pcinside/…’)\n#6 {main}\n thrown in /home/pcinside/domains/pcinside.info/public_html/wp-content/themes/Newspaper-child/functions.php on line 29\n’
[Mon May 23 15:12:50.246849 2016] [proxy_fcgi:error] [pid 3346:tid 140512100886272] [client 83.82.170.196:59912] AH01071: Got error ‘PHP message: PHP Fatal error: Uncaught Error: Call to undefined function visual_composer() in /home/pcinside/domains/pcinside.info/public_html/wp-content/themes/Newspaper-child/functions.php:29\nStack trace:\n#0 /home/pcinside/domains/pcinside.info/public_html/wp-includes/plugin.php(525): myoverride(”)\n#1 /home/pcinside/domains/pcinside.info/public_html/wp-settings.php(393): do_action(‘init’)\n#2 /home/pcinside/domains/pcinside.info/public_html/wp-config.php(106): require_once(‘/home/pcinside/…’)\n#3 /home/pcinside/domains/pcinside.info/public_html/wp-load.php(37): require_once(‘/home/pcinside/…’)\n#4 /home/pcinside/domains/pcinside.info/public_html/wp-blog-header.php(13): require_once(‘/home/pcinside/…’)\n#5 /home/pcinside/domains/pcinside.info/public_html/index.php(17): require(‘/home/pcinside/…’)\n#6 {main}\n thrown in /home/pcinside/domains/pcinside.info/public_html/wp-content/themes/Newspaper-child/functions.php on line 29\n’
[Mon May 23 15:13:00.543908 2016] [proxy_fcgi:error] [pid 3346:tid 140512352642816] [client 83.82.170.196:59920] AH01071: Got error ‘PHP message: PHP Fatal error: Uncaught Error: Call to undefined function visual_composer() in /home/pcinside/domains/pcinside.info/public_html/wp-content/themes/Newspaper-child/functions.php:29\nStack trace:\n#0 /home/pcinside/domains/pcinside.info/public_html/wp-includes/plugin.php(525): myoverride(”)\n#1 /home/pcinside/domains/pcinside.info/public_html/wp-settings.php(393): do_action(‘init’)\n#2 /home/pcinside/domains/pcinside.info/public_html/wp-config.php(106): require_once(‘/home/pcinside/…’)\n#3 /home/pcinside/domains/pcinside.info/public_html/wp-load.php(37): require_once(‘/home/pcinside/…’)\n#4 /home/pcinside/domains/pcinside.info/public_html/wp-blog-header.php(13): require_once(‘/home/pcinside/…’)\n#5 /home/pcinside/domains/pcinside.info/public_html/index.php(17): require(‘/home/pcinside/…’)\n#6 {main}\n thrown in /home/pcinside/domains/pcinside.info/public_html/wp-content/themes/Newspaper-child/functions.php on line 29\n’
[Mon May 23 15:13:00.864341 2016] [proxy_fcgi:error] [pid 3346:tid 140512163825408] [client 83.82.170.196:59922] AH01071: Got error ‘PHP message: PHP Fatal error: Uncaught Error: Call to undefined function visual_composer() in /home/pcinside/domains/pcinside.info/public_html/wp-content/themes/Newspaper-child/functions.php:29\nStack trace:\n#0 /home/pcinside/domains/pcinside.info/public_html/wp-includes/plugin.php(525): myoverride(”)\n#1 /home/pcinside/domains/pcinside.info/public_html/wp-settings.php(393): do_action(‘init’)\n#2 /home/pcinside/domains/pcinside.info/public_html/wp-config.php(106): require_once(‘/home/pcinside/…’)\n#3 /home/pcinside/domains/pcinside.info/public_html/wp-load.php(37): require_once(‘/home/pcinside/…’)\n#4 /home/pcinside/domains/pcinside.info/public_html/wp-admin/admin-ajax.php(22): require_once(‘/home/pcinside/…’)\n#5 {main}\n thrown in /home/pcinside/domains/pcinside.info/public_html/wp-content/themes/Newspaper-child/functions.php on line 29\n’, referer: http://www.pcinside.info/wp-admin/post.php?post=31&action=edit
[Mon May 23 15:13:00.995235 2016] [proxy_fcgi:error] [pid 6708:tid 140512447051520] [client 83.82.170.196:59923] AH01071: Got error ‘PHP message: PHP Fatal error: Uncaught Error: Call to undefined function visual_composer() in /home/pcinside/domains/pcinside.info/public_html/wp-content/themes/Newspaper-child/functions.php:29\nStack trace:\n#0 /home/pcinside/domains/pcinside.info/public_html/wp-includes/plugin.php(525): myoverride(”)\n#1 /home/pcinside/domains/pcinside.info/public_html/wp-settings.php(393): do_action(‘init’)\n#2 /home/pcinside/domains/pcinside.info/public_html/wp-config.php(106): require_once(‘/home/pcinside/…’)\n#3 /home/pcinside/domains/pcinside.info/public_html/wp-load.php(37): require_once(‘/home/pcinside/…’)\n#4 /home/pcinside/domains/pcinside.info/public_html/wp-blog-header.php(13): require_once(‘/home/pcinside/…’)\n#5 /home/pcinside/domains/pcinside.info/public_html/index.php(17): require(‘/home/pcinside/…’)\n#6 {main}\n thrown in /home/pcinside/domains/pcinside.info/public_html/wp-content/themes/Newspaper-child/functions.php on line 29\n’
[Mon May 23 15:13:01.186471 2016] [proxy_fcgi:error] [pid 6708:tid 140512226764544] [client 83.82.170.196:59925] AH01071: Got error ‘PHP message: PHP Fatal error: Uncaught Error: Call to undefined function visual_composer() in /home/pcinside/domains/pcinside.info/public_html/wp-content/themes/Newspaper-child/functions.php:29\nStack trace:\n#0 /home/pcinside/domains/pcinside.info/public_html/wp-includes/plugin.php(525): myoverride(”)\n#1 /home/pcinside/domains/pcinside.info/public_html/wp-settings.php(393): do_action(‘init’)\n#2 /home/pcinside/domains/pcinside.info/public_html/wp-config.php(106): require_once(‘/home/pcinside/…’)\n#3 /home/pcinside/domains/pcinside.info/public_html/wp-load.php(37): require_once(‘/home/pcinside/…’)\n#4 /home/pcinside/domains/pcinside.info/public_html/wp-blog-header.php(13): require_once(‘/home/pcinside/…’)\n#5 /home/pcinside/domains/pcinside.info/public_html/index.php(17): require(‘/home/pcinside/…’)\n#6 {main}\n thrown in /home/pcinside/domains/pcinside.info/public_html/wp-content/themes/Newspaper-child/functions.php on line 29\n’
[Mon May 23 15:13:01.350611 2016] [proxy_fcgi:error] [pid 6708:tid 140512835868416] [client 83.82.170.196:59926] AH01071: Got error ‘PHP message: PHP Fatal error: Uncaught Error: Call to undefined function visual_composer() in /home/pcinside/domains/pcinside.info/public_html/wp-content/themes/Newspaper-child/functions.php:29\nStack trace:\n#0 /home/pcinside/domains/pcinside.info/public_html/wp-includes/plugin.php(525): myoverride(”)\n#1 /home/pcinside/domains/pcinside.info/public_html/wp-settings.php(393): do_action(‘init’)\n#2 /home/pcinside/domains/pcinside.info/public_html/wp-config.php(106): require_once(‘/home/pcinside/…’)\n#3 /home/pcinside/domains/pcinside.info/public_html/wp-load.php(37): require_once(‘/home/pcinside/…’)\n#4 /home/pcinside/domains/pcinside.info/public_html/wp-blog-header.php(13): require_once(‘/home/pcinside/…’)\n#5 /home/pcinside/domains/pcinside.info/public_html/index.php(17): require(‘/home/pcinside/…’)\n#6 {main}\n thrown in /home/pcinside/domains/pcinside.info/public_html/wp-content/themes/Newspaper-child/functions.php on line 29\n’
[Mon May 23 15:13:01.536382 2016] [proxy_fcgi:error] [pid 6708:tid 140512572929792] [client 83.82.170.196:59927] AH01071: Got error ‘PHP message: PHP Fatal error: Uncaught Error: Call to undefined function visual_composer() in /home/pcinside/domains/pcinside.info/public_html/wp-content/themes/Newspaper-child/functions.php:29\nStack trace:\n#0 /home/pcinside/domains/pcinside.info/public_html/wp-includes/plugin.php(525): myoverride(”)\n#1 /home/pcinside/domains/pcinside.info/public_html/wp-settings.php(393): do_action(‘init’)\n#2 /home/pcinside/domains/pcinside.info/public_html/wp-config.php(106): require_once(‘/home/pcinside/…’)\n#3 /home/pcinside/domains/pcinside.info/public_html/wp-load.php(37): require_once(‘/home/pcinside/…’)\n#4 /home/pcinside/domains/pcinside.info/public_html/wp-blog-header.php(13): require_once(‘/home/pcinside/…’)\n#5 /home/pcinside/domains/pcinside.info/public_html/index.php(17): require(‘/home/pcinside/…’)\n#6 {main}\n thrown in /home/pcinside/domains/pcinside.info/public_html/wp-content/themes/Newspaper-child/functions.php on line 29\n’

I already renamed the js_composer directory to .js_composer to effectively disable it. I also reverted to PHP 5.6 legacy mode instead of PHP 7.0. So far no joy.

Bogdan B.
tagDiv Staff

Hi,
Unfortunately functions.php will not work from the child theme. The functions.php file in the child theme is different from the one in the main theme. This modification will have to be applied in the main file.
Thank you!

mc_kot
tagDiv Member

3,4) Catalin, I know it and I have already done everything that could have been done with that code and then removed it. I’m showing it to only as a reference of the code that should have worked in functions.php of the child theme, but didn’t work at all. If you don’t like that reference, please see one more code from your manual which didn’t work
add_filter( 'jpeg_quality', create_function('', 'return 50;' ) );

But it doesn’t matter if the code is from your manual or not. What I’m trying to explain is that none of the code pasted in the functions.php of the child theme works. Neither yours, nor anyone else’s. That is why I’m asking to your help.

6) so what is the proper way of making changes there and making sure it is not deleted when a new version of the theme is available?

Catalin
tagDiv Staff

Hello mc_kot,

3,4) Please notice that this type of code will have to be used only in the main theme because this is not tested with child theme and with it, you will get the list of registered CSS and js add the following code at the end of the functions.php file and then you will have to remove this code because you will have nothing to do with it. Please understand that this code is used only to show you the list with the id for all the CSS and js will appear on your site (top of the page). Copy and paste the list from your site into a .txt file. Please notice that all of this information are mentioned in our tutorial here -> https://forum.tagdiv.com/how-to-make-the-site-faster/ but it seems that you have missed them.
6)Also, please notice that all the thumbs are created in td_config.php and this type of folder is part of our wp_booster core. Please notice that all the files which are from this folder cannot be written in the child theme.
11) Please notice that one of these id’s come from your untested plugins (wp-geo) and the other ones seems to come from our theme. Please notice that these will be applied to later than the others and you will have to increase yourself their priority. For more information in this regard, please check this topic here -> https://forum.tagdiv.com/topic/pagespeed-insights-google-fonts-problem/

Please notice that these customizations involves custom work and please notice that these are not covered by our support!!!

Thank you for your understanding!

mc_kot
tagDiv Member

3,4)

“I have checked your screenshots and these steps are corrected but please notice that I am not aware of what type of code you have added in your child theme, sorry! “

The code that I’m using was taken from your manual. It is not custom code.
function td_inspect_scripts() {
global $wp_scripts, $wp_styles;
echo 'registered scripts<br>';
foreach ($wp_scripts->queue as $handle) {
echo $handle . ' | ' . $wp_scripts->registered[$handle]->src . '<br>';
}
echo 'registered styles<br>';
foreach ($wp_styles->queue as $handle) {
echo $handle . ' | ' . $wp_styles->registered[$handle]->src . '<br>';
}
}
add_action( 'wp_print_scripts', 'td_inspect_scripts' );

So when I paste it in codebase functions.php — it works perfectly. WHen I add it to the child theme and remove from codebase — it stops working

please ensure that you are using the latest version of child theme which comes bundled with the latest version of Newspaper.

I’m using the latest version of the Newspaper theme as I have just purchased it and no updates information has arrived sinse then.

So the issue is that the child theme doesn’t work even though I make all the proper steps that are required to be made. ๐Ÿ™ Can you please help?

6) It works perfect. But again the changes stop working when I try to add them via child theme, but not through the main theme. As you confirmed that the steps I make are correct, it means the child theme doesn’t work at my web site for some reason. Can you please fix it?

11) Dear Catalin. I’m afraid you really confused me. I haven’t requested for additional customization. I’m requesting for proper work of the current version of the speed booster. I do not need additional customization. I’m totally fine with the current one. I’m asking for support as I noticed the plugin didn’t work for
โ€ข jquer
โ€ข jquery-migrate
โ€ข wpgeo
No additional customization is required. What is required is a proper work of basic customization.

mc_kot
tagDiv Member

1. thanks

2. Is there any chance you may consider adding vk.com share buttom in future? It would also be great if you could add a sharing possibility on the pictures.

3 and 4. It is named in the same way. So again. These are the steps that I do:
step 1. I open functions.php in the child folder https://gyazo.com/fea2016a1f0673e2b4633e1de3acb0a8
step 2. I add the code in the end of the file https://gyazo.com/d3ac607eb8cca0ca871b36e3305e97c8
step 3. nothing happens
If I add the same code in functions.php which is placed in codebase folder — everything works properly. So the question remains — what have I done wrong? The names of the files are the same in both folders child and codebase.

5. Is there any chance speed booster will be combitable with this plugin in future https://wordpress.org/plugins/cloudflare-flexible-ssl/ ? But thanks for the instructions. Now speed booster is active

6. It seems I asked the question improperly. I know that there is different crop options in different template. I meant โ€“ can you please let me know how to set different crop size to featured image in Default post template?

7. Sorry. It seems I wasnโ€™t clear with my question at all. Let me build my question in a different way. The issue is the following, letโ€™s say I have the article about Obama. And I set it to 3 different sections โ€“ I made the post featured + I put in Politics category and World category. It means that the article about Obama will appear on the home page 3 times. First time in the section with Featured posts. Second time in the section with Politics. Third time in section with World news. The question is how to avoid duplicating posts on the home page when the post is placed in different categories?

8. thanks. My hosting provided that he installed xcache on the server. Is it ok or it is better to ask him remove it and install APC for better performance of Newspaper theme?

9. compression is allowed at the hosting, but he told be that it is not enabled as CLoudFLare do gzip compression by default. Should I ask him to enable additional gzip compression at the server or the compression provided by CF is enough?

10. thanks

11. thanks. It helped for most of the files, accept three files:
โ€ข jquer
โ€ข jquery-migrate
โ€ข wpgeo

Google still detects them. Do you know how to fix this? This time I pasted the code in the correct place
https://gyazo.com/a509970a21bc4868f0cf41ffc1d8ca1a
https://gyazo.com/5704d7eff52baceb35e23fa76814614d

12. thanks
13. thanks

mc_kot
Participant
#0

Hello,

Thank you for the wonderful theme. Can you please help with several questions:
1. Unfortunately social counter doesnโ€™t work. Here is how it looks like https://gyazo.com/d3a5e93c412ea8c92faa87dbf18f1985 Everything was adjusted according to the provided instructions. You may see the it here http://freesmi.by/ on the right sidebar
2. Can you please let me know how to add vk.com share buttom?
3. What is a proper way of adding code to functions.php file in the child theme? When I simply add code here https://gyazo.com/c829207705804e51f76ee0dde7401ca9 nothing happens. The changes apply only when I make them in functions.php file placed in the mother folder (not child).
4. What is the proper way of using child theme? I made the following steps:
โ€ข I copied the child folder from here Themes\Newspaper-tf\code\Newspaper-child
โ€ข Pasted it to here /wp-content/themes/
โ€ข Then I opened functions.php file in the child theme and tried to make some additions, but nothing happened. I added the code here https://gyazo.com/100ac1b006855c8be7d7c14091e82559 But the code didnโ€™t work. It worked only when I added it to the functions.php file in the mother folder of the theme
โ€ข So can you please advise what is the proper way of making corrections to functions.php file in the child theme? Did I do something wrong? Why it didnโ€™t work?
5. Do you know any alternatives to CloudFlare Flexible SSL as it is not compitable with Speed Booster?
6. how to make the featured image cropped? For example instead of this โ€“ https://gyazo.com/72458b385e0f89a9d421657059e66e06 When the image takes almost all the screen, I would like to have all featured images cropped with specific size for example like here โ€“ https://gyazo.com/4abb6b786495c59078ab81851559cbeb โ€“ when the image smartly cropped and looks amazing. Is it something possible to featured images?

Thanks,
Denis.

Bjeff
tagDiv Member

Hi, I tried this function on the original theme, but could not get it to work in the child theme.

Both td_wp_booster_functions.php and td_module_single_base.php is present in the child theme.

What code do I have to include to have it recognized from the child theme?

jgreenwood
Participant
#0

Hello, we have moved to Newspaper theme from a previous theme that supported action hooks and filters, where we used our functions.php file to modify the page contents. For example, to show custom fields on posts, we used this code in our child theme functions.php:

// add album title, label and article subtitle to posts and pages
function vg_subtitle($posttitle) {
global $post;
$albumtitle = get_post_meta ($post->ID, 'Album Title', true);
$albumlabel = get_post_meta ($post->ID, 'Label', true);
$subtitle = get_post_meta ($post->ID, 'Subtitle', true);
echo $posttitle;
if ($albumtitle) echo '<div id="vg-albumtitle">' . $albumtitle . '</div>';
if ($albumlabel) echo '<div id="vg-albumlabel">' . $albumlabel . '</div>';
if ($subtitle) echo '<div id="vg-subtitle">' . $subtitle . '</div>';
}
add_action('thematic_postheader_posttitle','vg_subtitle');

I am wondering, does Newspaper support action hooks such as this, to display these custom fields? I am wondering where I might find the Newspaper theme equivalent to replace above ‘thematic_postheader_posttitle’ … ? Is there a support doc reference to theme action hooks and filters? Thanks!

hardysykes
Participant
#0

We are currently using NewsPaper Theme version 6.7 and want to upgrade to NewsPaper Theme version 7.0.1 We followed the steps for updating the theme using the FTP method from this link:

https://forum.tagdiv.com/how-to-update-the-theme-2/

After the upgrade the site breaks. The homepage does only shows our categories in the top left then the header for the site is shown. Seems like there is a CSS issue. Our child theme has only two files (style.css and functions.php). We are not sure why this is happening.

nycinsider
tagDiv Member

Yes, I read your canned answer at least a dozen times on this forum. Clearly you have a lot of users with RSS questions and you think a plugin or that WP Beginner article can help. And for most people, that isn’t the case.

So I’m hoping someone can actually help me.

Transitioning to NP themeโ€ฆand I know this doesnโ€™t fall under typical support but I am really hoping someone out there can help me. I have a custom RSS feed in my current site Iโ€™m trying to copy over (working on a staging server โ€“ not sure if that makes a difference).

I have added a functions.php to my child theme and added this code:

// First remove all the RSS feed links from wp_head using remove_action

remove_action( โ€˜wp_headโ€™,โ€™feed_linksโ€™, 2 );

remove_action( โ€˜wp_headโ€™,โ€™feed_links_extraโ€™, 3 );

// Then reinsert the main RSS feed by using add_action to call our function

add_action( โ€˜wp_headโ€™, โ€˜reinsert_rss_feedโ€™, 1 );

// This function will reinsert the main RSS feed *after* the others have been removed

function reinsert_rss_feed() {

echo โ€˜<link rel=โ€alternateโ€ type=โ€application/rss+xmlโ€ title=โ€โ€˜ . get_bloginfo(โ€˜sitenameโ€™) . โ€˜ ยป RSS Feedโ€ href=โ€โ€˜ . get_bloginfo(โ€˜rss2_urlโ€™) . โ€˜โ€ />โ€™;

}

//NEW RSS FEED function copied from previous developer

remove_all_actions( โ€˜do_feed_rss2โ€™ );

add_action( โ€˜do_feed_rss2โ€™, โ€˜acme_product_feed_rss2โ€™, 10, 1 );

function acme_product_feed_rss2( $for_comments ) {

$rss_template = get_stylesheet_directory() . โ€˜/feed-rss2.phpโ€™;

if( file_exists( $rss_template ) )

load_template( $rss_template );

else

do_feed_rss2( $for_comments ); // Call default function

}

add_filter( โ€˜the_content_feedโ€™, โ€˜my_rssfooterโ€™ );

add_filter( โ€˜the_excerpt_rssโ€™, โ€˜my_rssfooterโ€™ );

//NEW RSS FEED function copied from previous developer

function my_feed_thumbnail($content) {

if (is_feed() && has_post_thumbnail()) {

return get_the_post_thumbnail( get_the_ID(), โ€˜thumbnailโ€™ ) . $content;

}

return $content;

}

add_filter(โ€˜the_content_feedโ€™, โ€˜my_feed_thumbnailโ€™);

add_filter(โ€˜the_excerpt_rssโ€™, โ€˜my_feed_thumbnailโ€™);

//NEW RSS FEED function copied from previous developer

add_filter(โ€˜excerpt_lengthโ€™, โ€˜my_excerpt_lengthโ€™);

function my_excerpt_length($length) {

if ( is_feed() ) {

return 1500;

} else return 0;

}

โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”
then, also added a standard feed-rss2.php template to my child theme

But I still canโ€™t get it to work. The feed on the new site is the standard RSS feed, but thatโ€™s not what I want. I need my custom RSS feed.

THANK YOU in advance to anyone who may be able to help.

nycinsider
Participant
#0

Transitioning to NP theme…and I know this doesn’t fall under typical support but I am really hoping someone out there can help me. I have a custom RSS feed in my current site I’m trying to copy over (working on a staging server – not sure if that makes a difference).

I have added a functions.php to my child theme and added this code:

// First remove all the RSS feed links from wp_head using remove_action

remove_action( ‘wp_head’,’feed_links’, 2 );

remove_action( ‘wp_head’,’feed_links_extra’, 3 );

// Then reinsert the main RSS feed by using add_action to call our function

add_action( ‘wp_head’, ‘reinsert_rss_feed’, 1 );

// This function will reinsert the main RSS feed *after* the others have been removed

function reinsert_rss_feed() {

echo ‘<link rel=”alternate” type=”application/rss+xml” title=”‘ . get_bloginfo(‘sitename’) . ‘ » RSS Feed” href=”‘ . get_bloginfo(‘rss2_url’) . ‘” />’;

}

//NEW RSS FEED function copied from previous developer

remove_all_actions( ‘do_feed_rss2’ );

add_action( ‘do_feed_rss2’, ‘acme_product_feed_rss2’, 10, 1 );

function acme_product_feed_rss2( $for_comments ) {

$rss_template = get_stylesheet_directory() . ‘/feed-rss2.php’;

if( file_exists( $rss_template ) )

load_template( $rss_template );

else

do_feed_rss2( $for_comments ); // Call default function

}

add_filter( ‘the_content_feed’, ‘my_rssfooter’ );

add_filter( ‘the_excerpt_rss’, ‘my_rssfooter’ );

//NEW RSS FEED function copied from previous developer

function my_feed_thumbnail($content) {

if (is_feed() && has_post_thumbnail()) {

return get_the_post_thumbnail( get_the_ID(), ‘thumbnail’ ) . $content;

}

return $content;

}

add_filter(‘the_content_feed’, ‘my_feed_thumbnail’);

add_filter(‘the_excerpt_rss’, ‘my_feed_thumbnail’);

//NEW RSS FEED function copied from previous developer

add_filter(‘excerpt_length’, ‘my_excerpt_length’);

function my_excerpt_length($length) {

if ( is_feed() ) {

return 1500;

} else return 0;

}

————————————————————
then, also added a standard feed-rss2.php template to my child theme

But I still can’t get it to work. The feed on the new site is the standard RSS feed, but that’s not what I want. I need my custom RSS feed.

THANK YOU in advance to anyone who may be able to help.

daniel.baron
Participant
#0

Hello
I tried to add child theme for Newspaper but it doesn’t properly load the parents css and js
Even tried with this plugin Child Theme Wizard, but still the same
Instead of the side bar i get 2 blue headers with
Slider HTML
Jquery-Slider script

The example child theme does the same

functions.php

<?php /*

This file is part of a child theme called Newspapper Child.
Functions in this file will be loaded before the parent theme’s functions.
For more information, please read https://codex.wordpress.org/Child_Themes.

*/

// this code loads the parent’s stylesheet (leave it in place unless you know what you’re doing)

function theme_enqueue_styles() {
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));
}
add_action(‘wp_enqueue_scripts’, ‘theme_enqueue_styles’);

/* Add your own functions below this line.
======================================== */

and style.css

/*
Theme Name: Newspapper Child
Theme URI:
Description: A child theme of Newspapper 6
Author: admin
Author URI: http://vrn-dev.local
Template: Newspaper
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

/* == Add your own styles below this line ==
——————————————–*/

simchris
tagDiv Member

Welll…..

a) if you use the speed booster framework, you would put the code into the Speed Booster plugin settings per the docs for that and the example from Lucien; *and* likely any custom css into your style.css and not in theme panel; and ideally NOT use child theme, to mimize any flash of unstyled text

b) if you’re doing custom hacking of your site, you would put any functions for de/enqueue into the functions.php where all such WordPress “actions” go; then you’d manually put your style.css link in footer. The WordPress codex has good tutorial on how “enqueuing” (adding to queue) works in WP.

c) You would then use the critical CSS generator found in my thread, to put the above the fold CSS “inline” in the header.php file. This loads only the needed CSS for above the fold to load with page — no render blocking of CSS — and then the rest loads with remainder of page. — Trial and error on this stuff.

These efforts are toward solving the pesky lower score on Google PageSpeed Insights for mobile “above the fold render blocking…”

This is a bit “advanced” stuff most folks won’t tackle. But if you’ve got everything ELSE as optimized as possible, this is kind of the LAST thing to do.

And frankly, if you’re using the AMP system for mobile, for a lot of folks, this will be a non issue as Google products will be loading the AMP version vs the responsive mobile version anyway.

So, one could argue if you have a desktop score of 92 or higher, and you’re running “AMP” on your site for posts, you likely don’t need to stress as much as before on the mobile score on Google’s direct testing speed tool. ๐Ÿ™‚

( rant over . . . ) ๐Ÿ™‚

  • This reply was modified 10 years by simchris.
Andrei L.
tagDiv Member

Hi

Try the solution indicated in this topic to fix the pagination issue for hompage: https://forum.tagdiv.com/topic/wordpress-4-4-1-pagination-new-fix/ but I cannot guarantee that will work as we didn’t test it with V 1.7 of the theme.

Also try to use this code in td_wp_booster_functions.php file: http://screencast.com/t/T1qCb2vBRX8

if(empty($query->is_feed)) {
if ( $paged > 1) {
$query->set( ‘offset’, intval($offset) + ( ( $paged – 1 ) * $limit ) );
} else {
$query->set( ‘offset’, intval($offset) );
}
}
This should fix the issue with the pagination on category page. If this does not work then the only solution is to update the theme at the current version available on themeforest, V2.3.5.
If you make any customizations in theme’s files it’s a good practice to keep track on them such that you can add them again after theme it’s updated. You can save your custom code in a text file on your computer then re-add it again in theme’s files but make sure it does not affect the new theme implementation. Also you can use the child theme provided with the theme to make some customizations, just make sure that the modified files can be overwritten in it. For more details about its usage with Newsmag theme check our documentation here: https://forum.tagdiv.com/newsmag-child-theme-support/ also WordPress’s documentation could help: https://codex.wordpress.org/Child_Themes

Thanks!

mikedo7
tagDiv Member

Ok I seemed to have found the issue, I had these lines in my functions.php within my child theme:

if (!defined(‘TD_THEME_WP_BOOSTER’)) {
include TEMPLATEPATH . ‘/includes/td_config.php’;
include TEMPLATEPATH . ‘/includes/wp_booster/td_wp_booster_functions.php’;
}

Removing them seems to work out fine. Will let you know if I have any further issue.

Thanks

simchris
tagDiv Member

I don’t use child themes; don’t believe in them unless absolutely necessary as they are a CSS redirect, which I don’t like. Different from an “includes.” So, ideally if using child theme you would add it to the child functions.php if there is one — but I can’t speak as to it working or not working with child theme. Part of optimization process is NOT using child theme, was my point ๐Ÿ™‚

Sooooo….. one of the items might conflict with child theme. I put mine in main functions.php at bottom.

Chucho
tagDiv Member

Thanks for the quick reply Catalin.

How about overriding the function (from functions.php in the child theme) using higher priority?
I tried the following code (screenshot) and it’s working well, not loading any of the default files, but I’m unsure if it could be good as a long-term solution.


function override_fonts() {
td_global::$default_google_fonts_list = array (
'653' => array(
'css_style_id' => 'google_font_work_sans',
'url' => td_global::$http_or_https . '://fonts.googleapis.com/css?family=Work+Sans:400,700'
),
'654' => array(
'css_style_id' => 'google_font_bitter',
'url' => td_global::$http_or_https . '://fonts.googleapis.com/css?family=Bitter:400,700'
),
);
}
add_action( 'init', 'override_fonts', 20 );

โ†‘ Replace default fonts (Open Sans and Roboto) with custom ones (Works Sans and Bitter, also from Google)

Andrei L.
tagDiv Member

Hi

The style.css file is not included on the list with allowed files which can be modified in child theme because it’s included by default in child theme. Any child theme contains in its basic structure a style.css and functions.php file.
Regarding the code from child theme there is an important aspects that must be considered:
– if in previous theme’s version a specific code added in child theme worked fine that doesn’t mean that will work with a new theme version. When theme update many of its files are changed and it’s a good practice to check update_log.txt file for each update and see what files had been modified so if those specific files are used in the child theme you will have to check your customizations to not break the functionality of the theme.
In your case if the css code does not apply from child theme means that even the selector has been changed or there is a more powerful code in main theme style which override the css from child theme.
The css code it’s very tricky and always the most precis or most powerful selector apply the style for a specific element.

Thanks!

adriatikxhelo8
tagDiv Member

Thnx Edward. I paste it under the child themefunctions.php” and it worked ๐Ÿ™‚

cstibi
Participant
#0

Hi,
we are creating our new city portal with your amazing Nespaper theme.
We want to use Delightful Downloads plugin (https://wordpress.org/support/view/plugin-reviews/delightful-downloads) for document management.

When creating new downloadable document, there are two unnecessary windows that we want to hide:
– Custom Post Type – layout settings
– Revolution Slider Options

But we want to show them in post editor. What have to do for hide them using Delightful Downloads plugin?

We use child theme, so we could write something into child themes functions.php if necessary.

Thanks,
Tibor

Viewing 25 results - 476 through 500 (of 638 total)