Problem with div "main-content-inner"

Hello. First of all I’d like to congratulate you for your “Sparkling” theme, which I find absolutely awesome.
I’m not very experienced, but so far I managed to solve all problems thanks to the forum and the documentation.

Nevertheelss, after upgrading to WP 4.7, I stumbled upon a new problem, and I’m unable to find the cause.
My website is still a work in progress, so I cannot link it directly to you.

Basically I feed a custom template (based on archive.php, called “libro-template.php” and included in a plugin) a shortcode to show the fields of a custom taxonomy and other things. Every single one of them, except for one, are showing correctly. One of them, for some strangereason (to me) , after the update is showing:
<div class=“main-content-inner col-sm-12 col-md-12”>
So the main content becomes full-width, and the sidebar is pushed on the bottom.

All the other pages show correctly:
<div class="main-content-inner col-sm-12 col-md-8">

All the taxonomy pages are created by the same plugin, and all the taxonomies and their data is of the same type, so there shouldn’t be anything different. I checked everything I could think of. And in fact, before the update all worked fine. If I use the main theme instead of my child theme (I started with your official child theme), it’s the same. If I disable all the other plugins, it’s the same. It’s almost as if that particular “haunted” page was seen as a “page-fullwidth.php”, which is not. I have a backup of the site, but I’m unable to use it because I worked a lot on the site in these two days. So I really can’t understand. Something went awry with the database after the update? Leftovers from old themes?

I know it’s difficult to see what’s going on without accessing the site (I cannot make it public, yet), but it would be wonderful if you could at least give me a hint. What should I check? Any help appreciated!

Keep up the good work.

Hi @federico,

I hope you are well today and thank you for your question.

Actually these classes are set in the header.php file by calling the following function so if your page is not using the template page-fullwidth.php then it won’t set the class ‘col-sm-12 col-md-12’ to them.

function sparkling_main_content_bootstrap_classes() {
	if ( is_page_template( 'page-fullwidth.php' ) ) {
		return 'col-sm-12 col-md-12';
	}
	return 'col-sm-12 col-md-8';
}

Could you please share me the code from your libro-template.php file and the custom plugin that you have developed so that i can troubleshoot it on my test site?

Best Regards,
Movin

Thanks you very much for your willingness, Movin.
The problem was fixed under my nose when I wasn’t watching, and I’d like to share it since I was told there might be a bug in the theme.
Apparently the problem is caused by this change in WP 4.7:

Now works with any post type, not just pages.

In my case, it was fixed adding && is_page() in these parts of Sparkling’s functions.php:

function sparkling_content_width() {
  if ( is_page_template( 'page-fullwidth.php' ) && is_page() ) {
    global $content_width;
    $content_width = 1008; / pixels /
  }
}
add_action( 'template_redirect', 'sparkling_content_width' );

if ( ! function_exists( 'sparkling_main_content_bootstrap_classes' ) ) :
/**
 * Add Bootstrap classes to the main-content-area wrapper.
 */
function sparkling_main_content_bootstrap_classes() {
 if ( is_page_template( 'page-fullwidth.php' ) && is_page() ) {
  return 'col-sm-12 col-md-12';
 }
 return 'col-sm-12 col-md-8';
}
endif; // sparkling_main_content_bootstrap_classes

I hope it will be helpful. I attached my plugin (the template is in the plugin) just in case you still need to troubleshoot it.
Best regards,

Federico

You are most welcome here :slight_smile: