Viewing 1 replies (of 1 total)
  • Thread Starter stefk

    (@stefk)

    Hi all, i solved this:

    Add as per normal to functions.php

    The first bit is the backend fields, and the second bit is for display on front-end.

    1st BIT:
    [ Moderator note: Code fixed, please wrap code in backticks or use the code button. ]

    add_filter( 'woothemes_our_team_member_fields', 'my_new_fields' );
    function my_new_fields( $fields ) {
        $fields['misc'] = array(
            'name'            => __( 'Quotes', 'our-team-by-woothemes' ),
            'description'     => __( 'Staff Quotes', 'our-team-by-woothemes' ),
            'type'            => 'text',
            'default'         => '',
            'section'         => 'info'
        );
    	    $fields['misc2'] = array(
            'name'            => __( 'Qualification', 'our-team-by-woothemes' ),
            'description'     => __( 'Qualification', 'our-team-by-woothemes' ),
            'type'            => 'text',
            'default'         => '',
            'section'         => 'info'
        );
    	    $fields['misc3'] = array(
            'name'            => __( 'Cell', 'our-team-by-woothemes' ),
            'description'     => __( 'Cell', 'our-team-by-woothemes' ),
            'type'            => 'text',
            'default'         => '',
            'section'         => 'info'
        );
    
    		    $fields['misc4'] = array(
            'name'            => __( 'Email', 'our-team-by-woothemes' ),
            'description'     => __( 'Email', 'our-team-by-woothemes' ),
            'type'            => 'text',
            'default'         => '',
            'section'         => 'info'
        );
    
    			    $fields['misc5'] = array(
            'name'            => __( 'Linkedin', 'our-team-by-woothemes' ),
            'description'     => __( 'Linkedin', 'our-team-by-woothemes' ),
            'type'            => 'text',
            'default'         => '',
            'section'         => 'info'
        );
        return $fields;
    }

    2nd BIT:

    add_filter( 'woothemes_our_member_fields_display', 'my_new_fields_display' );
    function my_new_fields_display( $member_fields ) {
    	global $post;
    	$misc = esc_attr( get_post_meta( $post->ID, '_misc', true ) );
    	if ( '' != $misc ) {
    		$member_fields .= '<li class="misc">' . $misc . '<!--/.misc-->' . "\n";
    	};
    			global $post;
    	$misc = esc_attr( get_post_meta( $post->ID, '_misc2', true ) );
    	if ( '' != $misc ) {
    		$member_fields .= '<li class="misc">' . $misc . '<!--/.misc-->' . "\n";
    	};
    			global $post;
    	$misc = esc_attr( get_post_meta( $post->ID, '_misc3', true ) );
    	if ( '' != $misc ) {
    		$member_fields .= '<li class="misc">' . $misc . '<!--/.misc-->' . "\n";
    	};
    			global $post;
    	$misc = esc_attr( get_post_meta( $post->ID, '_misc4', true ) );
    	if ( '' != $misc ) {
    		$member_fields .= '<li class="misc">' . $misc . '<!--/.misc-->' . "\n";
    	};
    		global $post;
    	$misc = esc_attr( get_post_meta( $post->ID, '_misc5', true ) );
    	if ( '' != $misc ) {
    		$member_fields .= '<li class="misc">' . $misc . '<!--/.misc-->' . "\n";
    	};
    	return $member_fields;
    }

Viewing 1 replies (of 1 total)
  • The topic ‘How to Add Multiple New Fields – Help’ is closed to new replies.