How can I edit the footer in WordPress version 5.3.1?
footer.php:
do_action('creativ_musicial_action_before_footer' );
/**
* Hooked - creativ_musician_footer_top_section -10
* Hooked - creativ_musician_footer_section -20
*/
do_action( 'creativ_musician_action_footer' );
/**
* Hooked - creativ_musician_footer_end.
*/
do_action( 'creativ_musician_action_after_footer' );
<p>Test</p>
wp_footer(); ?>
</body>
</html>
I can not change the footer text in the GUI. This is the footer:
Which php file is the right one, and how can I change it?
You need to delete, or comment out, the line calling the function, creativ_musician_action_footer.
/* do_action( 'creativ_musician_action_footer' ); */
Optionally, you can add your own HTML in its place, if you want to add a custom footer of your own.
OR
You can open the functions.php and edit the function creativ_musician_action_footer so it has the text that you want.
However, neither of those are a great solution, because when you update the theme, your changes may be lost.
Instead, you should create a child theme and edit a copy of the footer file from your child's theme folder. By doing this your changes will be resilient through updates. There are plenty of tutorials on child themes, and it's fairly easy to do.
Here is the WordPress codex on child themes.
Essentially, in your child-theme folder, you'll create a new style.css, and a new functions.php, and copy over the orig footer.php file. Your child footer.php will override the version in the orig/parent's theme folder, so you need to copy the orig footer.php to your new child theme folder, then edit this copy to meet your needs. You'll probably also want to copy over the orig theme screenshot, or create a new one.
Related
I am currently working on a WordPress website, which has a Parent and Child Theme.
The Parent Theme is outputting the following statement, at the top of the WordPress Dashboard:
This theme requires the following plugins: Plugin A, Plugin B, Plugin C etc
Triggering this output, is the following code, within the Parent Theme's functions.php file:
require_once get_template_directory() . '/inc/plugins/class-tgm-plugin-activation.php';
Is there a way I could disable this, via the Child Theme's functions.php? Sure, I could comment it out within the Parent Theme, but this could get overridden during a future update. I did try to copy the entry, into the Child Theme's functions.php, then comment it out there, but that did not work.
Latest Effort
I went into the WordPress Dashboard, where I copied the notification message prefix:
This theme requires the following plugins:
I then went into the file located within get_template_directory() . '/inc/plugins/class-tgm-plugin-activation.php', where I found the above notification prefix, located within the do_action( 'tgmpa_register' ); function.
I then located the add_action for the do_action( 'tgmpa_register' ); within the /inc/functions/tgm-functions.php directory.
I then headed into the Child Theme, and duplicated the above folder hierarchy.
I then commented out both add_action and do_action, within their respective files as well as entering remove_action( 'tgmpa_register', 'register_required_plugins', 999 ); into the Child's functions.php file.
Unfortunately, neither of the above work. I take it, that this is because the Parent Directory parent_theme/inc has priority over the Child Directory child_theme/inc? If so, is there a way to change this?
I've to customize the header in Enfold theme of my WP site. I placed the company logo to the left and under this I placed the primary menu. I need to add another image near to the company logo. I 'created' a theme child and I would like to add a widget to place image on the right of the company logo but the theme expected in the header the company logo and the primary menu only. Can I customize my header to do this? Can you help me please? Thank's!
If you have purchased the enfold theme, you will get the child theme along with that. Your header part (menu and logo) is running from helper-main-menu.php file which is located at enfold/includes/helper-main-menu.php
Now to get this in child theme add the header.php to your child theme and then add a folder named includes and keep a copy of helper-main-menu.php. This should be as same as in parent theme.
Now you can edit your child theme files and add as many widgets you need.
I have tested and it worked for me.Happy Coding :)
I have noticed that your theme is from themeforest so you should create a child theme, then copy your header.php in child theme folder. Then make changes on that file.
For creating a child theme, make a folder inside your 'themes' folder with you child theme name. Now the child theme should have a style sheet in it which is a must. So add a style sheet and the beginning of the child theme style sheet should be as follows:
/*
Theme Name: (theme name) Child
Theme URI: (give URL)
Description: (give description)
Version: (give your version)
Author: (author name)
Author URI: (give URL)
Template: (name of parent theme)
*/
Of these the very important thing is the 'Template' which is the parent theme name. To avoid confusion take the name of parent theme from the parent theme style sheet.
Now the second thing is the functions of your child theme. Just add a php file with the name functions.php and place the below code.
<?php
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
?>
This code is for enqueuing the parent theme styles. Here you go! your child theme will work now.
I've created child themes before without issue however when I create one using Woocommerce Mystile theme it does not display properly with menu items missing and images resizing to be too large.
I made the child theme by creating a new folder in the wp-content>themes folder called mystile-child and creating style.css with the contents
/*
Theme Name: Mystile Child
Description: Mystile Child Theme
Template: mystile
*/
I then created a functions.php file with the contents
<?php
add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );
function enqueue_parent_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
}
?>
this is what the parent theme looks like:
This what the child theme looks like
Just out of curiousity - were the logo and other missing elements set up intially using the theme customizer (reached via the wordpress admin menu Appearance > Customize)?
If that's the case, then those settings are created outside of your theme and need to be reset or imported for your child theme. There are a few ways to accomplish this, the easiest way being with a plugin which imports/exports those Customizer settings.
Hope that helps,
Laura
Okay I fixed the problem following the advice found on Wordpress.org support forum here https://wordpress.org/support/topic/mystile-theme-child-header-problem
Seems more of temporary fix though and something that the people at Woocommerce should investigate.
I am currently developing a child theme that builds on twentyfifteen as a parent theme. However a potential issue has cropped up that is causing a problem.
I want to strip the CSS and JS assets from the parent theme twentyfifteen, but these are loaded from the theme's functions.php file with wp_enqueue_style and wp_enqueue_script, I have commented out these lines in the functions.php file so that now these CSS and JS assets are not longer loaded - but isn't it he case that if an update is released for the twentyfifteen parent theme, that when it is updated - the functions.php file will be overwritten along with any commenting out I have done. So in other words when it is updated the unwanted CSS and JS assets will be reloaded.
What is the best solution here? Can I prevent twentyfifteen loading it's stylesheet and JS without editing it's functions.php file (as this file will only be updated and changes overwritten?) Surely there is a better way of doing this.
I'm currently developing a child theme for with a base of twentyfifteen and have been left wondering if it would just be best to create an independent theme rather than a child theme as a workaround to this issue.
Try <?php wp_dequeue_style( $handle ) ?> where $handle is the name (slug) of the enqueued stylesheet. Similarly <?php wp_dequeue_script( $handle ); ?> for scripts.
See the codex:
https://codex.wordpress.org/Function_Reference/wp_dequeue_style
https://codex.wordpress.org/Function_Reference/wp_dequeue_script
I've created a Wordpress child theme and now want to remove the widgets from the sidebar. However all the tutorials are not helping.
Each one says to add the following code to my functions.php file in my child theme:
<?php
function unregister_old_sidebars() {
unregister_sidebar('sidebar-1');
}
add_action( 'widgets_init', 'unregister_old_sidebars' );
?>
However, do I copy the entire functions file from the parent theme and copy it in a new functions.php in my child theme, or is this the ONLY code that I put into my child theme functions.php file.
Nothing I do seems to be working.