Support » Plugins » CodeSnippter

  • Hallo,

    ich benötige beim Singleproduct einfach mehr Tabs.
    Ich habe via CodeSnippet ein Snippet erstellt.
    Jedoch wenn ich hier Texte eintragen egal ob mit Tab oder mit <br/> wird der Text immer als Fließtext ohne Absätze etc angezeigt.

    Gibts es hier eine Lösung oder evtl eine Alternative zu CodeSnippet?

    Mein Code lautet wie folgt:

    add_filter('woocommerce_product_data_tabs', 'misha_product_settings_tabs' );
    function misha_product_settings_tabs( $tabs ){
     
    	//unset( $tabs['inventory'] );
     
    	$tabs['misha'] = array(
    		'label'    => 'Misha',
    		'target'   => 'misha_product_data',
    	);
    	return $tabs;
     
    }
     
    /*
     * Tab content
     */
    add_action( 'woocommerce_product_data_panels', 'misha_product_panels' );
    function misha_product_panels(){
     
    	echo '<div id="misha_product_data" class="panel woocommerce_options_panel hidden">';
     
    	woocommerce_wp_text_input( array(
    		'id'                => '_category_head_name',
    		'value'             => get_post_meta( get_the_ID(), '_category_head_name', true ),
    		'label'             => 'Überschrift der Kategorie',
    		'description'       => 'Description when desc_tip param is not true'
    	) );
     
    	woocommerce_wp_textarea_input( array(
    		'id'          => '_text_cat',
    		'value'       => get_post_meta( get_the_ID(), '_text_cat', true ),
    		'label'       => 'Content',
    		'desc_tip'    => true,
    		'description' => 'Prove the plugin changelog here',
    	) );
     
    
     
    	echo '</div>';
     
    }
    
    add_action( 'woocommerce_process_product_meta', 'woocommerce_process_product_meta_fields_save' );
    function woocommerce_process_product_meta_fields_save( $post_id ){
        // This is the case to save custom field data of checkbox. You have to do it as per your custom fields
       $woocommerce_text_field = $_POST['_category_head_name'];
    	if( !empty( $woocommerce_text_field ) )
    		update_post_meta( $post_id, '_category_head_name', esc_attr( $woocommerce_text_field ) );
    	$woocommerce_textarea = $_POST['_text_cat'];
    	if( !empty( $woocommerce_textarea ) )
    		update_post_meta( $post_id, '_text_cat', esc_html( $woocommerce_textarea ) );
    }
    
    add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' );
    function woo_new_product_tab( $tabs ) {
    	
    	// Adds the new tab
    	
    	$tabs['test_tab'] = array(
    		'title' 	=> __( get_post_meta( get_the_ID(), '_category_head_name', true ), 'woocommerce' ),
    		'priority' 	=> 50,
    		'callback' 	=> 'woo_new_product_tab_content'
    	);
    
    	return $tabs;
    }
    
    function woo_new_product_tab_content() {
    
    	// The new tab content
    
    	echo  get_post_meta( get_the_ID(), '_text_cat', true )  ;
    	
    }

    Die Seite, für die ich Hilfe brauche: [Anmelden, um den Link zu sehen]

Ansicht von 2 Antworten - 1 bis 2 (von insgesamt 2)
Ansicht von 2 Antworten - 1 bis 2 (von insgesamt 2)
  • Das Thema „CodeSnippter“ ist für neue Antworten geschlossen.