• Hi, Is it possible to have a list of checkboxes instead of a multiple select for category selection in the front end writer? I managed to have the list of checkboxes in the front-end by changing these lines

    public function get_taxonomy_list( $taxonomy ){
    		$terms = get_terms($taxonomy, array(
    			'hide_empty' => 0
    		));
    		if (!$terms || empty($terms)) return '';
    		//preg_match_all('/\s*<option class="(\S*)" value="(\S*)">(.*)<\/option>\s*/', $terms, $matches, PREG_SET_ORDER);
    		$out = apply_filters( 'pfs_taxonomy_label', "<label for='terms_$taxonomy'>Seleziona i corsi</label>", $taxonomy );
    		$out .= "<select id='terms_$taxonomy' name='terms_$taxonomy' size='4' multiple='multiple'>";
    		foreach ($terms as $term){
    			if (is_taxonomy_hierarchical($taxonomy))
    				$out .= "<option value='{$term->term_taxonomy_id}'>{$term->name}</option>";
    			else
    				$out .= "<option value='{$term->name}'>{$term->name}</option>";
    		}
    		$out .= "</select><br />\n";
    		return apply_filters("pfs_{$taxonomy}_list",$out);
    	}

    with these

    public function get_taxonomy_list( $taxonomy ){
    		$terms = get_terms($taxonomy, array(
    			'hide_empty' => 0
    		));
    		if (!$terms || empty($terms)) return '';
    		//preg_match_all('/\s*<option class="(\S*)" value="(\S*)">(.*)<\/option>\s*/', $terms, $matches, PREG_SET_ORDER);
    		$out = apply_filters( 'pfs_taxonomy_label', "<label for='terms_$taxonomy'>Seleziona i corsi</label>", $taxonomy );
    		foreach ($terms as $term){
    			if (is_taxonomy_hierarchical($taxonomy))
    				$out .= "<input class='{$term->term_taxonomy_id}' type='checkbox' value='{$term->term_taxonomy_id}' /> {$term->name}<br />";
    
    			else
    				$out .= "<input class='{$term->term_taxonomy_id}' type='checkbox' value='{$term->name}' /> {$term->name}";
    		}
    		$out .= "<br />\n";
    		return apply_filters("pfs_{$taxonomy}_list",$out);
    	}

    but I guess I have to edit something else too, because now the post is posted without categories, even if I select them.
    Any help would be appreciated!

    https://www.ads-software.com/extend/plugins/post-from-site/

  • The topic ‘[Plugin: Post From Site] Checkbox instead of select multiple category: how to?’ is closed to new replies.