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

    No search results were found in Documentation!

Results from the Forum
alintiniuc
Participant
#0

I’d like to change the width on the Module 11 thumbnail size. I have already updated my custom css to move the title and excerpt more to the right and I have also updated the Module_11.php and added it to the child theme with the new dimensions but when I do that it breaks the images. Even using thumbnail regen didn’t fix the issue.

I have also tried adding the correct code to the child theme functions.php but the images are still broken. I assume there might be another .php I didn’t update or havent updated the child theme functions.php correctly.

Could you point me in the right direction please.

My desired thumbnail size would be 267×178 for the module 11 thumbnails.

You can view the test site at http://test.sneakerbardetroit.com.

Thank You

paradice
tagDiv Member

I found this post: https://forum.tagdiv.com/topic/child-theme-2/ and followed the instructions. Removing the line in functions.php solved all of the warnings.

Sorry I didn’t read that first!

katsdelight
Participant
#0

Hi,

After I installed the child theme I have these eror in the dashborad

Warning: include(/home/katsdeli/public_html/review/wp-content/themes/Newsmag/includes/td_wordpres_booster.php) [function.include]: failed to open stream: No such file or directory in /home/katsdeli/public_html/review/wp-content/themes/Newsmag-child/functions.php on line 9

Warning: include() [function.include]: Failed opening ‘/home/katsdeli/public_html/review/wp-content/themes/Newsmag/includes/td_wordpres_booster.php’ for inclusion (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/katsdeli/public_html/review/wp-content/themes/Newsmag-child/functions.php on line 9

Warning: Cannot modify header information – headers already sent by (output started at /home/katsdeli/public_html/review/wp-content/themes/Newsmag-child/functions.php:9) in /home/katsdeli/public_html/review/wp-includes/option.php on line 750

Warning: Cannot modify header information – headers already sent by (output started at /home/katsdeli/public_html/review/wp-content/themes/Newsmag-child/functions.php:9) in /home/katsdeli/public_html/review/wp-includes/option.php on line 751

Please can you let me know what the problem could be.

fbengo
tagDiv Member

It happens because there is no td_wordpres_booster.php anymore. You can fix this by removing the following code from your functions.php in your child theme:

if (!defined('TD_THEME_WP_BOOSTER')) {
include TEMPLATEPATH . '/includes/td_wordpres_booster.php';
  • This reply was modified 11 years by fbengo. Reason: functions.php instead of style.css ofcourse xD
fernandofloresf3
Participant
#0

I have updated theme item but when active theme child is shown a few warning codes in the blog and in the administration panel please, can you help me to solve this problem. The lines of code that come out are:

Warning: include(/home/obispadoelalto/public_html/demo/wp-content/themes/Newsmag/includes/td_wordpres_booster.php) [function.include]: failed to open stream: No such file or directory in /home/obispadoelalto/public_html/demo/wp-content/themes/Newsmag-child/functions.php on line 9

Warning: include() [function.include]: Failed opening '/home/obispadoelalto/public_html/demo/wp-content/themes/Newsmag/includes/td_wordpres_booster.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/obispadoelalto/public_html/demo/wp-content/themes/Newsmag-child/functions.php on line 9

simchris
tagDiv Member

You can avoid CSS import by not using a child theme.
You can remove query strings by using the functions I have previously recommended for adding to your functions.php file. You can also optimize your thumbnails by editing your functions.php file to set higher compression level for WP, and then run the “Regenerate Thumbnails” plugin.

Add these to bottom of your functions.php file, for one example:

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;' ) );

add_action('init', 'myoverride', 100);
function myoverride() {
remove_action('wp_head', array(visual_composer(), 'addMetaData'));
}

You can optimize your site following the documentation for this theme:
https://forum.tagdiv.com/page-speed-guide/

monicacortes
tagDiv Member

Hello Lucian,

This last solution seems very complicated.

We have added the first code, in order to add the post title to the alt tag of the images when it doesn’t exist.

We have added it to the original functions.php file (not in the child theme function.php file).

But as you can see in the code of this old page, is not working:

view-source:http://marronyblanco.com/secadora-prosteam-aeg/

How can we solve it?

Thank you in advance.

JRodwell
Blocked
#0

Hi,

First of all thanks for a great theme. We have run into a slight issue starting our development though… We would like to use a child theme under Newspaper to retain the ability to upgrade the parent theme as new versions come out. We noticed you provide a child theme template to make this easier. However it seems much of the code in functions.php and elsewhere is not wrapped in pluggable functions – if(function_exists(…)) – which would enable us to override the entire function, and also get_template_directory() is used extensively instead of get_stylesheet_directory() which would check the child theme directory structure for a file before reverting to the parent theme.

It seems like this makes it very difficult (impossible?) to use a child theme effectively. Is this correct? Or have we missed something? Any help would be much appreciated.

Cheers,

J.R.

glikoz
tagDiv Member

I’m using Newspaper Child Theme and I’ve added code lines to functions.php in Child Theme, everything seems ok except search
still http://www.futbolne.com/ara (ara means search) gets 404 error. (Also /search didn’t work before changing)
Any suggestion for it?

Lucian
tagDiv Staff

Hi,

1. That is because you logo it’s at 65px height, you can fix this using this custom css in theme panel > custom css field: http://screencast.com/t/6SpPjfGIz7F

.header-logo-wrap {
margin-top: 25px;
margin-bottom: 27px;
}

.header-logo-wrap img {
padding-top: 20px
}

2. You need to add &subset=latin,latin-ext in case you use the speed booster plugin which uses those fonts, we will consider this, until then you can copy the functions.php file inside you child theme and add the latin extended support there. You can read how to do this following this guide: https://forum.tagdiv.com/child-theme-documentation/

3. You can do it like this: https://forum.tagdiv.com/topic/move-comments-above-similar-articles/#post-24724
4. You can a new sidebar and set it only for bbpress forum template like this: http://screencast.com/t/6Vc9ISLruES
Then you can add your widgets there: http://screencast.com/t/ECEMy9Licix
5. It can be due to the theme as the theme overwrites the bbpress templates and restyles them, you could try to translate it from theme panel > translation and the ones you can edit and find the missing words here: http://screencast.com/t/XgcJXFfTKe and replace them from there.

Regarding page speed you can follow this forum topic as there have been many issue debated here and you can find solution for your issue there: https://forum.tagdiv.com/topic/pagespeed/
You can also follow this guide: https://forum.tagdiv.com/how-to-make-the-site-faster/

Thanks

Cagatay
Participant
#0

Hello,

my web site is http://www.outdoorhaber.com

First issue:
As you will notice the 728px adsense ad at the top doesn’t fit in header. Header alignment doesn’t work, because it also takes the logo up or down when I give -/+ pixels.

Second issue:
I didn’t find open sans latin extended in custom topography section. I noticed this post https://forum.tagdiv.com/topic/problem-with-the-font-on-big-slide/ but I don’t get it, why don’t you simply add native latix-extended support to the theme? latin-extended languages are widely used. I don’t want to update functions.php everytime I update the theme. I simply want to select it from a list.
Can you please add open sans latin-extended support from theme interface in the next version.
Until then, can you please tell me which code to add to functions.php in “child theme”

Third issue:
http://www.outdoorhaber.com/north-face-mens-evolution-triclimate-ceket-inceleme/ As you can see here, comments are at the very bottom of the page. How can I take them above “related articles” section ?

Fourth issue:
http://www.outdoorhaber.com/forum/ I want to put different widgets only to bbpress pages. (login widget, etc) how do I do that?

Fifth issue:
http://www.outdoorhaber.com/forum/ Bbpress was Turkish before I switched to newspaper theme, now it is English. What do you think has happened? Can it be something with Newspaper theme? (if not please ignore this issue)

I have other, speed optimization related questions, but let’s leave them for another day. Congratulations for creating such a great, clean theme.

Thanks in advance.

wpdiv
Participant
#0

Hello team tagdiv

First of all i congratulate everyone to build powerful magazine style wordpress theme.

Hugs and kisses for everyone 😀

I have played with newspaper theme options for the past couple of days and i found some nice features as well small lack of features, please help me to troubleshoot the same.

1. There are plenty of google fonts added with theme, how can i remove them via child theme without touching core wordpress theme files? In another thread, you have replied that, comment the google font files in master theme functions.php. But its not advisable. How can i remove the google fonts by using child theme?

(Note : If you provide a option to disable google web fonts in theme panel itself, will be most welcome.)

2. I am using child theme in my website (under development) and its working well till newspaper 4.4, but after replace the newspaper 4.5 theme, i am unable to view the theme panel settings drop down. Just refer the screenshot

http://i.share.pho.to/f913a8c5_o.png

Expecting your kind reply asap

With regards
Selvam.S

simchris
tagDiv Member

Basically what I’ve done for my site is
(not using child themes as they add CSS redirects bad for SEO/speed)

a) search/replace all instances of fonts I don’t want to load from Google in my style.css file; using common font stacks for fallback such as 'Open Sans',Arial,sans-serif
(if you don’t know what font stacks are, see: http://cssfontstack.com/

b) set all my fonts in theme panel to ‘default’ so there is no code if/then trying to insert any custom fonts into header/footer/speedbooster

c) commented out the code in functions.php which loads google fonts on the page; and also removed the section of code which has the various links to theme fonts on google I won’t be using; no need to have if/then code asking to load fonts from google if I’m never going to do that via theme code (as per examples in my prior posts in this thread); need to both or you will get error. Same code in 4.22, 4.3 and 4.4 versions of theme.

d) I grabbed the link from google fonts website for the font I wish to use (as per my example above in this thread), then pulled the actual css from that link so I won’t be loading the links to the fonts from their CSS file (one less CSS file loaded on page); placed this at bottom of my own style.css file after the minified code, so that it lives in its own section after theme styles.

All of this was done with caching off, mod_pagespeed off, so that changes are picked up immediately. When editing my files I use either TextPad on the PC, or BBEdit on the Mac, to ensure my files have Linux/Unix line breaks since I’m using Linux web server. Some PC editors will put “Windows line breaks” in files, which are bad for Linux servers, in some cases, and can cause parsing errors. So, helps to know what you’re doing if editing core files for a web server.

PURPOSE OF ALL OF THIS:
1) speed up website
2) remove intermediate call to CSS style sheet on google, which may not have proper expiration headers/TTL, and may show “advisory” from testing GTMetrix,PageSpeed Insights, etc. – may help “rating” by removing one so-called issue caused by Google’s own system.

You do *NOT* need to do this, unless you have ALL OTHER optimizations in place. Many sites load their fonts from Google using their function call as it’s essentially loading from a CDN. However, “hacking” the theme for this purpose can help advanced users resolve those last couple of ratings issues, and also those obsessed with micro-optimizations.

WARNING
this hack must be done EVERY time you update the theme; so if not willing to do that, best to skip this whole subject and get on with creating great content which is better for SEO and SERPS than saving a couple of milliseconds on font loading.

simchris
tagDiv Member

I posted how to do this recently, but don’t have the link, unfortunately. Perhaps do a quick forum search.

Remember, too, to search/replace the calls to Google fonts in the style.css file, too. And ensure you turn off your cache if using one, prior to making changes.

Also note some folks have trouble doing this when using child theme, if the child them css calls the fonts or a fuctions over ride file calls them.

I think you need to remove the whole section in 4.2x in functions.php which if I recall was lines 41 to 84 … you’re basically removing that “function” ….

TheMediumUTM
tagDiv Member

Child themes are indeed handy. Christopher recently said he doesn’t use them because of the pagespeed slowdown in CSS importing, if I understood him right, which is valid but it does prevent things like this. If you’re a heavy modifier of files, each update will be painful…

Child themes basically make WP use the version of the file in the child theme rather than the parent theme’s, if one exists. Hence your changes would survive updates.

Also, not all of those files can be modified in a child theme (I believe td_wordpress_booster.php can’t, for example). For those ones, you would have to copy the function in question into your child theme’s functions.php, make your changes, and rename the function. Then either change all references to the function in other files, or it’s a hooked action or filter, unhook the parent functions and hook yours in. (There are a few tutorials out there for this.)

Even if you use a child theme, you would want to watch for updates that affect functions and styles you’ve changed and do your changes over again, but it’s not as big a deal.

A block 10 is also included in the latest update, so you’d want to rename your custom one to avoid it being overwritten.

simchris
tagDiv Member

I keep a folder with copies of the files I hack each update so I can remember them at a glance, a text file with my additions to put at bottom of functions.php and note as to which section by line number x-x to remove; and a text file with cheat sheet of the search/replace for the style.css file. Not too painful. Kind of started when I had existing read/hit counter and needed to update the module to load the existing “field” vs the one used by Newspaper for hit counting. Then it was uncommenting the author byline each time in the main post file. Then it was the custom font loading. Well, there you are. As long as I have my local “cheats” folder, I can usually open two windows with both old stuff and new version of theme and then just top to bottom change stuff in new update folder, and then upload to server and it’s like nothing changed for the stuff I modified.

And, benefit is the style redirect issue that Google doesn’t like with child themes, and much easier to deal with any custom css over-rides as well as issues with tagdiv’s in house speedbooster plugin, etc.

At least this has been my experience 🙂

TheMediumUTM
tagDiv Member

I seem to remember having little luck with that. I think the way I ended up doing it was copying, renaming, and editing the functions in my child theme functions.php, then removing the action or filter of the parent function and adding the action or filter of my own.

TheMediumUTM
tagDiv Member

It looks like you’ve done it almost exactly right. But I have these notes:

1. I made a mistake when I said to use the_field — change all instances to get_field in the code.

2. If you can’t activate a child theme, your code modifications won’t survive a theme update anyway and you’ll have to redo it each time you update. 🙁 Still, it should work. And it’s fine if you use that block of code instead of the functions.php way I quoted.

3. Once you have that code in your template files, you don’t need to do anything from the post editing page besides enter those custom fields.

4. If you’re not seeing anything show up when you view the post, you might be putting your code in the wrong single post template file. There are seven of those in this theme: loop-single.php, loop-single-1.php, single_template_2.php, single_template_3.php, single_template_4.php, and single_template_5.php. You could put the above code in whichever template file you’ve picked in Theme Panel -> Post Settings, or you could put it in every template file.

5. Just to make sure, where are you putting the code in the template file? (Which lines come right before and after it?)

doran
tagDiv Member

Thank you Lucian,

I appreciate you support.

Kind Regards

TheMediumUTM
tagDiv Member

Note! I should have used get_field, not the_field, up there. the_field echoes it right away but get_field gives you the data so you can put it in a tab.

One last thing is that if you’re going to use this in all your templates, you should probably just go to your child theme’s functions.php and turn the code into a function. You have to pass the post ID to that function as well. It should look like this:


function my_custom_field_tabs($post_id) {
  // all the code I posted above, indented
 ...
}

Except that instead of echo $to_echo; you’ll have return $to_echo;, and instead of $data_1 = get_field('field_1');, you'll have$data_1 = get_field(‘field_1’, $post_id);`.

Then, wherever you want to insert the tabs in a template, you would just use this one line:


<?php echo my_custom_field_tabs($post->ID); ?>
Lucian
tagDiv Staff

Hi,

1. Looks fine to me, this is “Ubuntu” on your page: http://screencast.com/t/tyYTqVEex and look’s to me like it dose on google fonts page: http://screencast.com/t/BsD9l6Xvi the point is that the fonts do change, please use the one that looks fine, from I have noticed the one that you are using now looks fine and supports the turkish characters.

2. This usually happens because of the speed booster plugin which move the css and js at the bottom of the page structure so that the page will load faster, this is why the theme blue color appears first then changes, because of the cascading property of css, the same regarding fonts.
What you can do is to use the method I suggested before and change the color and the fonts directly into the css style-sheet which will make your colors and your fonts to load first and stay that way. You could also deactivate the plugin if you don’t need it.

3. Regarding the theme panel’s custom typography I have made some tests with it to check if it’s working well and noticed that works just fine for widgets title:
This is what I have chosen: http://screencast.com/t/M9V7tFarfe
This is the result: http://screencast.com/t/suckL0bGpf
This only changes the widgets title, not the block title, for that you will need custom css.
For the menu items also works: http://screencast.com/t/Qr3UD6bMeo

Try to change it yourself like this, I’m not sure why it dose not work for you, it may be due to some plugins or the speed booster plugin which overwrites the settings from theme panel, try this without any plugin activated and check if works.
Like I said before the best solution would be to replace the fonts and color as you like and need into the style.css file, this will solve both issues if you want to use the speed booster plugin or try to see if this works without the plugin.

Sorry for the delay, hope this helps!
Thanks

doran
tagDiv Member

I got confused.

1) Open sans works fine but ubuntu,roboto etc. do not. They look different.

Roboto: http://prntscr.com/4jbd9r
Ubuntu:http://prntscr.com/4jbdp8
Roboto and Ubuntu(google fonts page): http://prntscr.com/4jbfff

2) Blue default color loading first is not fixed. I re-installed the plugin and update again the theme. nothing changed. Last solution does not make any meaning because problem is not only blue color. Default template loads first. all fonts and colors change.

3) All I need is a website with latin extended fonts. I want to change widget, menu, h1, h2, title. etc.. fonts and colors using theme panel.

All these fonts and colors supposed to be changed by theme panel. But, in this situation, theme panel has no fuction.
or
(Theme Panel > Custom Typography) never works. I have to change everything manually with css. Is this right?

It has been just two weeks, that I bought the theme. I can start all over if there will be no problems like these.

What do you recommend?

Lucian
tagDiv Staff

Hi,

I just checked your site and seems to me it’s working fine using both fonts Roboto/Open sans: http://screencast.com/t/dylrBRszw I have enlarged the block title font here so you can see that if you use this font the turkish characters look fine also.

Use the css like this if you want to change the block titles: http://screencast.com/t/BPwIBCHr2z

.column_container .block-title span {
font-family: "Open Sans" !important;
line-height: 28px;
}

Regarding the blue default color loading first, please re-install the speedbooster plugin and also update the theme to the latest version 4.2.2. Before this please make sure you make a backup of your current theme files so you can revert if something goes wrong.
If that dose not help, try this solution: https://forum.tagdiv.com/topic/about-default-theme-colors/#post-17657
Hope this helps!

Thanks

doran
tagDiv Member

Thanks Lucian,

It didnt worked. I only want to change block title font not all parts. So add only this to custom css:

.block-title span {
    font-family: "Roboto Condensed" !important;
}

Would you please check? http://www.konsantrepo.com/

Apart from this, when I open the website, I first see the blue title block which is default, then it becomes grey which is my choice.

If I modify something on theme panel, do I need to write a custom css for every single change?

Regards,

Lucian
tagDiv Staff

Hi,

Should work, make sure you have done this right, I have checked this on your site and worked fine: http://screencast.com/t/V7N6kBvv

Thanks

Viewing 25 results - 576 through 600 (of 638 total)