WordPress.org

Make WordPress Themes

Opened 4 years ago

Closed 3 years ago

#19304 closed theme (live)

THEME: Healthy WP - 1.0.5

Reported by: StefanRisticDev Owned by: jcastaneda
Priority: theme update Keywords: theme-healthy-wp
Cc: stefan.ristic@…

Attachments (1)

search-form.png (48.3 KB) - added by jcastaneda 4 years ago.

Download all attachments as: .zip

Change History (15)

#1 @StefanRisticDev
4 years ago

Removed

$output = substr_replace($output, 'class="last-menu-item menu-item', strripos($output, 'class="menu-item'), strlen('class="menu-item'));

from functions.php, line 110. I forgot to remove it, and it's causing menus with just one menu item to break.

#2 @jcastaneda
4 years ago

  • Owner set to jcastaneda
  • Status changed from new to reviewing

#3 @jcastaneda
4 years ago

There should be nothing after the wp_head() call.

What you can do is actually hook it to that. Something like:

add_action( 'wp_head', 'js_script' );
function js_script(){ ?>
<script>
jQuery(document).ready(function($){
	$('.mobile-menu-item').change(function(){
		var url = $(this).val();
		if ( url.length ) {
			window.location.href = url;
		}
	});
});
</script>
<?php } // end js_script

Part of that reason is some plugins may rely on that and can lead to unexpected results.

You also appear to have an unclosed div in your search form.

#4 @StefanRisticDev
4 years ago

Thank you for your revision.

I've moved the JS code to functions.php file as suggested.

Re the unclosed <div> in the search form - I've actually added that one because the search widget generates one </div> more than needed(not sure why). The code passes W3 validation both with and without the search widget...

Should I re-upload the next version? Or unclosed <div> is still a problem?

#5 @jcastaneda
4 years ago

Odd that it generates an unclosed div.

Are you using any plugins? I can't seem to get that using a clean install. Not only that core markup for the search_form shows a closing div. https://core.trac.wordpress.org/browser/tags/3.9.1/src/wp-includes/general-template.php#L204

yes, upload. :)

#6 @themetracbot
4 years ago

  • Summary changed from THEME: Healthy WP - 1.0.3 to THEME: Healthy WP - 1.0.4

#7 @StefanRisticDev
4 years ago

Thanks :)

With all plugins deactivated, WordPress 3.9.1, this is the structure when I remove the div:

<aside id="search-2" class="widget-container widget_search"><form role="search" method="get" id="searchform" action="http://www.vezbe.org/healthy-wp/">
    <label id="searchlabel" class="screen-reader-text" for="searchinput">Search for:</label>
        <input type="text" value="" name="s" id="searchinput">
</form></aside>
<div id="sidebar">
<aside id="search-2" class="widget-container widget_search"><form role="search" method="get" id="searchform" action="http://www.vezbe.org/healthy-wp/">
    <label id="searchlabel" class="screen-reader-text" for="searchinput">Search for:</label>
        <input type="text" value="" name="s" id="searchinput">
</form></aside></div>

#8 @jcastaneda
4 years ago

Part of that reason is because there is no widget title. I'll add the scenario of a child theme using the form on a 404 page or even a random template. As you can see in the image it breaks the layout.

#9 @StefanRisticDev
4 years ago

That's bad. It does break the layout when the search form is added somewhere else in the template...

I guess I'll have to figure out why the widget is adding an additional closing div.

#10 @jcastaneda
4 years ago

When you're registering your widget look at that code. It creates an open div tag after the title with a class of widget-content and in the after_widget it creates the closing div.

#11 @themetracbot
4 years ago

  • Summary changed from THEME: Healthy WP - 1.0.4 to THEME: Healthy WP - 1.0.5

#12 @StefanRisticDev
4 years ago

Thank you for your help.

The search form should work fine now, both inside and outside the sidebar.

I've removed the widget-content div, that was causing the issue when there is no widget title.

#13 @jcastaneda
4 years ago

  • Status changed from reviewing to approved

Cool, cool.

  • All issues have been resolved
  • marking as approved

And happy to help.
-Jose

#14 @chipbennett
3 years ago

  • Resolution set to live
  • Status changed from approved to closed

Currently approved Theme, batch-synced as Live

Note: See TracTickets for help on using tickets.