Forums

Problem with an option inside a Theme (1 post)

  1. optikfluffel_
    Member
    Posted 1 year ago #

    This stuff does not work correctly. What can i do now?

    function portfoliocategory() { // Display Category list on "Portfolio Theme Settings" Page
        $fcat = wp_dropdown_categories('orderby=id&order=ASC&hide_empty=0&echo=0');
    	$fcat = str_replace("\n", "", $fcat);
    	$fcat = str_replace("\t", "", $fcat);
    	$fcat = str_replace("<select name='cat' id='cat' class='postform' ><option value=\"", "", $fcat);
    	$fcat = str_replace("</option><option value=\"", "_", $fcat);
    	$fcat = str_replace("\">", "-", $fcat);
    	$fcat = str_replace("</option></select>", "", $fcat);
    
    	echo "<select name=\"portfoliocategory\" id=\"portfoliocategory\">";
    
    	$fcat = explode("_", $fcat);
    	foreach($fcat as $category)
    	{
    
    		$category = explode("-", $category);
    		$cat_number = $category[0];
    		$cat_name = $category[1];
    
    			echo "<option name=\"$cat_number\"";
    				if (get_option("portfoliocategory") == "$cat_name id:$cat_number") { echo ' selected="selected"'; }
    			echo ">$cat_name id:$cat_number</option>";
    
    	} // End Foreach;
    
    	echo "</select>";
    
    }

Topic Closed

This topic has been closed to new replies.

About this Topic