Divi Child Theme Breaks Wordpress Customizer - php

I am having an issue with the wordpress customizer and Divi. Customizer works fine with just Divi activated, but when I activate a child theme the customizer suddenly stops working. It displays on the user facing side, but will not render in customizer.
I get this error from Chrome:
"bpmmarketing.com redirected you too many times."
So I of course made sure my functions file was kosher, which it is.
Here's that code (from elegant themes):
<?php
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' );
?>
I am seeing this error in the console:
load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,jquery-ui-core,jquery-ui-widget,jquery-ui-mo…:3
GET
http://bpmmarketing.com/?customize_changeset_uuid=9610c2a0-37d1-4b5a-abd6-d…ccfb7c&customize_theme=BPM+Marketing&customize_messenger_channel=preview-0
net::ERR_TOO_MANY_REDIRECTS
We have the site protected right now, but please let me know if you need any other information.

Your theme folder might contain spaces, for example "Divi child". If so you must change it to "Divi-child" and problem solved.
If not you can set the permalinks to plain as a workaround, but this is not good for SEO.

Related

Wordpress child theme style.css has stopped working

really hoping someone can please help me! I just updated the Divi parent theme on my Wordpress site (www.ellymacdonalddesign.com), and the child CSS theme seems to have stopped working.
I've tried the solutions from this question, but they do not seem to work for me:
Wordpress child theme style.css not working
My child functions.php file is currently:
<?php
function my_theme_enqueue_styles() {
$parent_style = 'divi-style';
wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
wp_enqueue_style( $child-style, get_stylesheet_uri() );
}
?>
Would really appreciate any guidance please, thank you in advance,
Elly
Is your variable $child-style have any value? According to document, the handle name (first parameter) is required. That's why your child theme still not working.
Try below code to see if it's work:
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
$parent_style = 'divi-style';
$child_style = 'divi-style-child';
wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
wp_enqueue_style( $child_style, get_stylesheet_uri() );
}
Changing the css child theme version number helped solve the problem on my website.
My child theme was working correctly until I decided to change some css rules in the style.css file from the Wordpress 'Theme Editor' interface. I remarked that no changes appeared on the website, although the css was obviously loaded in the header and also I purged all cache.
I tried solutions of the following question but I think this is for new child theme installation, not an already working one: Wordpress child theme style.css not working
I decided to change the version number of my child theme, and the modifications were finally taken into account.
/*
Theme Name: Chromatic-child
Template: chromatic
Version: 1.1.0
*/

The Conflict of jQuery on WP (Admin Panel doesn't work correctly)

I'm using a custom Wordpress Theme for my blog. This theme is working good in the website but on the back, the widgets can't moving/automatically closing etc. I've tried to solve this problem with
define( 'CONCATENATE_SCRIPTS', false );
on WP-config. It solved the problem for widgets but right now, I can't upload featured image for posts. (It shows me an error about it couldn't upload, but it uploads and I can't see the library in wp-admin/post.php. I can see all images in wp-admin/upload.php
My functions.php looks like that:
function aax_scripts() {
// Styles
wp_enqueue_style( 'Bootstrap-4', get_template_directory_uri().'/bootstrap/4.1.1/css/bootstrap.min.css');
wp_enqueue_style( 'AAX-Style', get_stylesheet_uri() );
wp_enqueue_style( 'Google-Fonts', 'https://fonts.googleapis.com/css?family=Oswald|Roboto|Libre+Franklin');
wp_enqueue_style( 'Font-Awesome', get_template_directory_uri().'/fontawesome/fontawesome-free-5.2.0-web/css/all.css');
// Scripts
wp_enqueue_script("jquery");
wp_enqueue_script( 'Bootstrap-4', get_template_directory_uri() . '/bootstrap/4.1.1/js/bootstrap.min.js');
wp_enqueue_script( 'Popper', get_template_directory_uri() . '/js/popper.min.js');
};
add_action( 'wp_enqueue_scripts', 'aax_scripts' );
What should I do?
Thanks.
I found the solution. This problem is not about jQuery.
The source of problem is a commenting function in theme's function.php file.
if ( $GLOBALS['wp_query']->max_num_pages < 2 ) {
The function includes a global query and WP using queries everywhere. It was looking cool on page but it doesn't means it's a good code.
Be careful your functions. Don't be me.

Wordpress - white screen of death when trying to update a page and/or a file in Editor

I'm loading a front-end site onto wordpress using a child theme of html5blank and I'm getting the white screen treatment - bizarrely (or not?) I'm only getting it when I hit the update button on a page or when I hit 'update file' from within Appearance>Editor.
I believe I've done all the standard checks - plugins, theme (why would I even get access if it was the theme?). I've looked on phpmyadmin and can't really see anything there.
This is what I have in my functions.php -
<?php
function my_theme_enqueue_styles() {
$parent_style = 'html5blank-style'; // This is 'html5blank-style' for the HTML 5 Blank theme.
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' );
?>
I've only just started the website build - I've only got Akismet and Hello Dolly in the plugin panel and neither of them are activated. Can anyone spot something in the functions.php that I can't see or is there other things I need to check?
Having conducted a more in-depth search I found this article - and took the advice on hand by adding this code to my wp-config.php file -
error_reporting(E_ALL); ini_set('display_errors', 1);
define( 'WP_DEBUG', true);
This code points you towards the error on the white space, in my case it related to too much white space in my functions.php file. This article helped me sort the issue out. All is now working as is.
If you have a simple child theme with style.css and functions.php and you get a white screen for example if you update a post or try to change/load other themes during customization than you have to open your functions.php in your child theme directory. Remove all white spaces and all lines. It will work after that.
Child-theme with white screen error:
<?php
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
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') ); //Comment with to much white space
}
?>
new child theme without errors
<?php
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
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') );//Comment updated without space
}
?>
Btw: I have the second line because with first line I cannot overwrite the original style.css. Second line helps to do it without anything else.

What code do we mdoify in functions.php for a WordPress child theme?

I was following along to this example in the official tutorial
<?php
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' );
?>
But then they had this line
where parent-style is the same $handle used in the parent theme when it registers it's stylesheet.
What does that even mean?
I am creating a child theme for Bazaar Lite and the directory name is bazaar-lite
How should I modify my file?
Looks like a bit of a typo in the docs, actually. If you look at the simpler example just above that one on the doc page, they use "parent-style" literally. You could still use "parent-style" no problem there.
So to answer your question, you should be able to use that code that you showed as is, without any modifications.
Hope this helps!

Linking stylesheets from main site to Wordpress child theme

I have a website not running on Wordpress, but have installed Wordpress in the /blog sub directory. I'm trying to modify the chosen Wordpress theme to match the header of my website. I've managed to come relatively close, but by placing duplicate .css and .js files within the child theme.
What I want to do is give the proper path while enqueueing from functions.php - I'm just unfamiliar with .php and how to do so. Here's what I have:
<?php
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'freelance-main', get_stylesheet_directory_uri() . '../../../freelancer.css' );
wp_enqueue_style( 'bootstrap-min', get_stylesheet_directory_uri() . '../../../bootstrap.min.css' );
wp_enqueue_style( 'bootstrap-main', get_stylesheet_directory_uri() . '../../../bootstrap.css' );
wp_enqueue_style( 'child-style',get_stylesheet_directory_uri() . '/style.css',
array('parent-style')
);
}
?>
From viewing the page source it's actually trying to load the "../" in the url so I know this isn't right, I just don't know how to type it properly. Here's the structure:
root
-mywebsite
--blog
---wp-content
----themes
-----child-theme
--css
---needed files
--js
---needed files
Like I said, if I duplicate the files and put them in the child-theme it works, but I don't think this is best practice.

Categories