Error when trying to change css for childtheme

Hello,

At one point I started to get following error when trying to edit css of childtheme (for sparkling)

Warning: Cannot modify header information - headers already sent by (output started at /htdocs/mytheme/wp-content/themes/childtheme/functions.php:8) in /htdocs/mytheme/wp-includes/pluggable.php on line 1228

Before this happened I modified functions of childtheme as suggested by WPML, because their language switcher did not work with your theme. Now I removed those lines from functions.php but error still applies.

  1. How to get css editing working again? 2. Please let me know where in header shall I add php line for language switcher if I would like to display it in the primary menu bar?

to functions.php added php was:
// Filter wp_nav_menu() to add additional links and other output

// Show only other language in language switcher

// Use the new filter: https://wpml.org/wpml-hook/wpml_active_languages-2/

add_filter(‘wp_nav_menu_items’, ‘new_nav_menu_items’, 10, 2);

function new_nav_menu_items($items, $args) {

// uncomment this to find your theme's menu location

//echo "args: <pre>"; print_r($args); echo "</pre>";



// get languages 

$languages = apply_filters( 'wpml_active_languages', NULL, 'skip_missing=0' );



// add $args-&gt;theme_location == 'primary-menu' in the conditional if we want to specify the menu location.



if ( $languages &amp;&amp; $args-&gt;theme_location == 'primary') {

	$items = $items . '&lt;li class="menu-item menu-item-has-children dropdown"&gt;' . "\n";

	

	// construct the parent menu item 

	foreach($languages as $l){

		$items = $items . '<a href="' . $l['url'] . '"><img src="' . $l['country_flag_url'] . '" height="12" alt="' . $l['language_code'] . '" width="18" /> &lt;span class="caret"&gt;&lt;/span&gt;</a>' . "\n";

		unset($languages[$l['language_code']]);

		break;

	}

	

	// construct the children menu items 

	$items = $items . '&lt;ul role="menu" class=" dropdown-menu"&gt;' . "\n";



	foreach($languages as $l){

		$items = $items . '&lt;li class="menu-item"&gt;';

		$items = $items . '<a href="' . $l['url'] . '"><img src="' . $l['country_flag_url'] . '" height="12" alt="' . $l['language_code'] . '" width="18" /></a>';

		$items = $items . '</li>' . "\n";

	}



	$items = $items . '</ul>' . "\n";

	// end - construct the children menu items 

	

	$items = $items . '</li>';		

}



return $items;

}

Hi @sandras,

Sorry to hear of the problem you are having.

1. How to get css editing working again?

Could you please share me your child theme so that i can troubleshoot it on my test site?

2. Please let me know where in header shall I add php line for language switcher if I would like to display it in the primary menu bar?

You have to develop custom code using following wp_nav_menu_items filter to add it in the primary menu bar.

Best Regards,
Movin