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

Results from the Forum
bz
Participant
#0

Hello,

I’ve read the official WooThemes documentation about changing the “Add to cart” button text and I’ve added the snippet there to the Newspaper-child functions.php. However, the the text on the website still remains the same.

Is there something specific to the Newspaper theme that needs to be adjusted as well?

Using WordPress 4.6.1 and WooCommerce 2.6.4, Newspaper 7.4

I’d appreciate your help!

Bogdan B.
tagDiv Staff

Hi,

The child theme is a bit complicated to understand at first. It is basically a re-write of the main theme.
Not all of the files in our theme will work from the child theme though .The main functions.php file requires custom implementation to be able to re-write the main file and all of the WP_Booster folder will not work as well from the child theme. If you move the post template files to the child, the theme will use those files and not the ones from the main theme. You have to use this guide to create the child theme properly: https://forum.tagdiv.com/the-child-theme-support-tutorial/ It’s basically a mirror image of the main theme.
However there is one important thing to know about a child theme. It is not update proof. This is a common mistake users make and update their themes and do not update the child theme causing lots of issues. The child theme serves the file you add to it. if that file is modified in a future update and you serve the old modified version of the file from the child theme, there could be consequences.
\So when using a child theme you have to keep a look-out if the files you added to the child theme get updated. If they do, you need to re-create your child theme with the current theme files and re-apply your modification. A child theme helps you skip a few updates as not all files get modified on each update but it is not update proof.

I hope this is clear enough…

Thanks.

Bogdan B.
tagDiv Staff

Hello,

Unfortunately I cannot help as we have not tested the go pricing cart plugin. Please try your code in the main functions.php file, not in the child theme to see if it works from there. if it does not, it could require adaptation to work with our theme but plugin implementation in not part of the theme support i’m afraid.
You will have to get some hired help if you cannot do it yourself.

Thank you for your understanding.

BIBI
Participant
#0

Hello folks,

I want to add horizontal scrollbar to my Go Pricing chart. Plugin developer told me to paste the code into my (child)theme function.php folder. Unfortunately when i try to edit functions.php file Websites is not responding..

Can you please tell me where should i place php code, in order to change plugin layout..

fullworksmedia
Participant
#0

Hi there,
I’m using Newspaper 7 Child theme and added ‘all Gravity Forms capabilities to Editor role’ code into the functions.php. Unfortunately it doesn’t seem to work. This code works fine when using it with other templates, so I assume there must be something with the way your child theme works.

Any idea how could I get this code to work? Gravity Forms’ support says to add it into the functions.php, but it doesn’t work in this case.

/**
* Add all Gravity Forms capabilities to Editor role.
* Runs when this theme is activated.
*
* @access public
* @return void
*/
function grant_gforms_editor_access() {

$role = get_role( ‘editor’ );
$role->add_cap( ‘gform_full_access’ );
}
// Tie into the ‘after_switch_theme’ hook
add_action( ‘after_switch_theme’, ‘grant_gforms_editor_access’ );

Many thanks,
Adam

Alexpo
Participant
#0

Hello, guys.

I want to change article lists H3 title to another. I found includes/wp_booster/td_module.php file and place where it need to change. But, I use a child theme and when I copied that file to my theme folder – it did not work. Seems it because file td_module.php connect in file includes/wp_booster/td_wp_booster_functions.php through require_once(‘td_module.php’).

Is there a way to make changes in child theme td_module.php whithout changes parental theme file?

hcnsupport
tagDiv Member

I am using a child theme, but only the functions.php file.

Rick

Akshay Upadhyay
Participant
#0

This is my first website. i have no idea od coding and website designing. i have just installed Newspaper theme, kindly guide me how can i install my Child theme ? In my Child theme folder i have two files 1. functions.php and 2. style (cascading style sheet document )
AM i supposed to get a child them .zip file??? is it missing ?
kindly guide me how to upload the child them

abburi005
tagDiv Member

Hi Bogdan,

Thanks for your reply.
We have modified functions.php & style sheet of the child theme(folder) in version 6.7 and added some new files in the child theme. So is it okay to take the backup of modified files(functions.php & style sheet) and newly created files and update the theme to the new version and again add the customisation of functions.php & style sheet of the child theme(folder) and add newly created files? If we do like this will our site work as is or any issues arise?

Thanks
Abburi

Bogdan B.
tagDiv Staff

Hi,

The child theme is a bit complicated to understand at first. It is basically a re-write of the main theme.
Not all of the files in our theme will work from the child theme though .The main functions.php file requires custom implementation to be able to re-write the main file and all of the WP_Booster folder will not work as well from the child theme. If you move the post template files to the child, the theme will use those files and not the ones from the main theme. You have to use this guide to create the child theme properly: https://forum.tagdiv.com/the-child-theme-support-tutorial/ It’s basically a mirror image of the main theme.
However there is one important thing to know about a child theme. It is not update proof. This is a common mistake users make and update their themes and do not update the child theme causing lots of issues. The child theme serves the file you add to it. if that file is modified in a future update and you serve the old modified version of the file from the child theme, there could be consequences.
\So when using a child theme you have to keep a look-out if the files you added to the child theme get updated. If they do, you need to re-create your child theme with the current theme files and re-apply your modification. A child theme helps you skip a few updates as not all files get modified on each update but it is not update proof.

I hope this is clear enough…I know it’s a mouth full. 😛

Thanks.

starfishcapital
Participant
#0

Hi Team,

I am trying to remove the image and author meta tags (<meta property=”og:image”> and <meta name=”author”>).

I have created a child theme and located the code for the above in includes/wp_booster/td_wp_booster_functions.php. I have copied it using the same structure to my child theme and commented out the section on the above. See below:

/* facebook sharing fix for videos, we add the custom meta data
if (has_post_thumbnail($post->ID)) {
$td_image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
if (!empty($td_image[0])) {
echo '<meta property="og:image" content="' . $td_image[0] . '" />';
}
}

// show author meta tag on sigle pages
$td_post_author = get_the_author_meta('display_name', $post->post_author);
if ($td_post_author) {
echo '<meta name="author" content="'.$td_post_author.'">'."\n";
}*/

However the two meta tags still appear.

Thanks for helping me out on this.

popngen
tagDiv Member

Bogdan,

I managed to fix my css issues, by removing functions.php and using

@import (../Newspaper/style.css)

.. in my child theme’s style.css. I then reloaded the theme and now my custom css is working. I still don’t know what the problem was.

Thank you for the tip, I will definitely try using live css to test from here on out.

Winock
Participant
#0

I started a site with in the future many posts arround regions, herefore i use more and more different widgets, is there a way where i can see wich post is connected to wich widget?

i was thinking in my child theme in functions.php to add some code where the output is in admin posts. if i open my overview of posts, i can see the title, author, category, tags, date, views, … it should be excelent to become an extra column with the Widget area.

is this posible?

David L
tagDiv Member

Hi, Brian here.

Yes the site works with vanilla 7.3 and the sidebar is fine.

However: I’m trying to get a child theme working and every time I turn the child theme on the homepage messes up and the sidebar disappears.

Here’s what I’ve done:

Folder called: Newspaper-7_3-IC-Child
style.css
/*
Theme Name: Newspaper 7.3 Israellycool Child Theme
Theme URI: https://themeforest.net/item/newspaper/5489609?s_rank=1
Description: Newspaper 7.3 Israellycool Child Theme
Author: Brian of London
Author URI: http://www.israellycool.com
Template: Newspaper
Version: 7.3 [corresponds to theme version 7.3]
*/

functions.php
<?php
// Added by Brian of London BoL 2016-07-20
// Updated 2016-08-18 to try to rework after 7.3
// switched from old method of child theme loading
// "Note that the previous method was to import the parent theme stylesheet using @import:
// this is no longer best practice, as it increases the amount of time it takes style sheets to load. "
//
//

function my_theme_enqueue_styles() {

$parent_style = 'parent-style'; //

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

That’s it, no other changes made yet (I’ve got a screenshot.png file in the folder too).

As soon as I select that child the sidebar suddenly jumps to the bottom of the page, before the footer.

mikehenze
tagDiv Member

Thanks.
You might want to add that i should use a childtheme for this?
Or can this be added using a php snippet using a plugin that add stuff to functions.php

fiftyfifty
tagDiv Member

With my fingers crossed and backups in place I did the upgrade. And you’re right that it’s fairly simple to do. But since we have over a dozen of bulky plugins I always get cold sweat with updates like these.

What I do by the way, is simply rename the (folder) new version to Newsmag_3_1 and upload it next to the previous versions. I don’t see a reason why that should’t work, is it? And then I update our child theme accordingly. (CSS & functions.php).

GideonLupine
tagDiv Member

I had an issue where all my social sharing buttons disappeared and other weirdness.

http://cowboylifestylenetwork.com/chef-magbanua-brings-experience-creativity-arroyo-grille/

I had to copy the images directory into the child theme.

I also updated the style.css from the new child theme.

I don’t think the change long had any changes to functions.php or header.php.

Bogdan B.
tagDiv Staff

Hi,

If you want to change a function from functions.php then it gets a bit more complicated as the functions.sphp will not re-write the function in the main theme. You will have to set priorities for them. Maybe this guide will help you understand better how this works: http://code.tutsplus.com/tutorials/a-guide-to-overriding-parent-theme-functions-in-your-child-theme–cms-22623

Thank you!

frankwl
tagDiv Member

Excellent. Good to learn.

Final question:
when changing this in the parent-theme files it is not update safe.

Can I overwrite that function in my child-theme functions.php?


if ( ! function_exists( 'get_item_scope' ) ) :
function get_item_scope() {
//show the review meta only on single posts that are reviews, the rest have to be article (in article lists)
// if ($this->is_review && is_single()) {
// return 'itemscope itemtype="' . td_global::$http_or_https . '://schema.org/Review"';
// } else {
// return 'itemscope itemtype="' . td_global::$http_or_https . '://schema.org/Article"';
}

daimpa
tagDiv Member

I’m sorry but I don’t get your reply, do you mean that I can only wait that the css cache expries on users’ browser?

To be clear, my problem now is that some users see the theme like this (screen taken from another website here, perfectly showing my issue).
Again, not using any CDN or cache plugin.

What if I make the following change to the functions php files in the child theme?… I mean, change 2.0c to 3.0…. Please note that this is my full functions.php in the child theme.

NOW

<?php
/*  ----------------------------------------------------------------------------
    Newsmag 2.0 Child theme - Please do not use this child theme with older versions of Newsmag Theme

    What can be overwritten via the child theme:
		- please read the child theme documentation https://forum.tagdiv.com/the-child-theme-support-tutorial/

 */

/*  ----------------------------------------------------------------------------
    Here we add the parent style and the style.css from the child theme folder
 */
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles', 1000);
function theme_enqueue_styles() {
    wp_enqueue_style('td-theme', get_template_directory_uri() . '/style.css', '', '2.0c', 'all' );
    wp_enqueue_style('td-theme-child', get_stylesheet_directory_uri() . '/style.css', array('td-theme'), '2.0c', 'all' );

}

NEW

<?php
/*  ----------------------------------------------------------------------------
    Newsmag 2.0 Child theme - Please do not use this child theme with older versions of Newsmag Theme

    What can be overwritten via the child theme:
		- please read the child theme documentation https://forum.tagdiv.com/the-child-theme-support-tutorial/

 */

/*  ----------------------------------------------------------------------------
    Here we add the parent style and the style.css from the child theme folder
 */
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles', 1000);
function theme_enqueue_styles() {
    wp_enqueue_style('td-theme', get_template_directory_uri() . '/style.css', '', '3.0', 'all' );
    wp_enqueue_style('td-theme-child', get_stylesheet_directory_uri() . '/style.css', array('td-theme'), '3.0', 'all' );

}

Could this solve my problem?

  • This reply was modified 10 years by daimpa.
  • This reply was modified 10 years by daimpa.
richardprins
tagDiv Member

Hi, I edited the file indicated in one, but in the newspaper theme. I added the edited file to newspaper-child/includes/modules, and I have functions.php and styles.css included in the newspaper-child root folder.
Nevertheless, the social buttons still appear when I open an article. Should I perform an extra step to ‘activate’ the child theme, or do I have to edit different files in Newspaper?

wwth
Participant
#0

Hi,

Updated to theme 7.1.1 and updated my Child Theme php which all pulls through correctly and has the desired effect.

However, the style.css is having no effect at all on the site.

To ensure (as much as possible) this has nothing to do with any mistake on my behalf I have created a new child theme that ONLY consists of the functions.php and style.css file you supply.

I still get the same result…the style.css file has no effect.

Please help!

MrOrsh
Participant
#0

Hello! Just updated to the latest version (from 6 > 7). Most things seems to be working fine except from the Child Theme.

1. If i upload the child theme as it is (with only style.css and functions.php) the site gets an extra menu (just like in this post) and I get a double logo + some more small issues. Have tried disabeling my plugins to check if any of them is causing the issue, but it seems weird since no files are actually changed. Only thing happened is the child theme being loaded.

2. I was also wondering about the new mobile-menu. Is there any way to change the colors or anything with it? I also have an issue when using iOS that the X up in the right corner gets a thick white line behind it (imagine a .gif or .png image that is supposed to be transparent but isnt).

newtag
Participant
#0

Hi,

How can i remove (deregister) the default style.css file of the Main AND the Child theme? I will use a custom stylsheet and do not need both style.css files.

a function for the functions.php for example would be awesome
thanks

wirsindwerder.de
Participant
#0

Hi, I have a particular problem with the mega menu.

I have included in the “functions.php” of child themes a PHP script, with which it is possible to add also categories and keywords to pages. Works perfectly.

Problem: When I select a category with various subcategories in megamenu he does not show me the connected thumbnails. When I select a category without subcategories in megamenu, he shows me the thumbnails correctly.

It would be very important in the menu for me to display not posts, but pages in subcategories.

Is there the possibility to solve this problem? Of course I would pay.

Viewing 25 results - 451 through 475 (of 638 total)