Change Order of Displaying a Custom Field
-
Hey,
Following the tutorial, I was easily able to add a custom field:
add_filter( 'woothemes_our_team_member_fields', 'organization_field' ); function organization_field( $fields ) { $fields['misc'] = array( 'name' => __( 'Organization', 'our-team-by-woothemes' ), 'description' => __( 'Enter an Organization for the team member (for example: "Premazon Inc.").', 'our-team-by-woothemes' ), 'type' => 'text', 'default' => '', 'section' => 'info' ); return $fields; }
I was also able to get that information to display on the front end (where I’m using shortcodes to call the team members)
add_filter( 'woothemes_our_member_fields_display', 'organization_field_display' ); function organization_field_display( $member_fields ) { global $post; $misc = esc_attr( get_post_meta( $post->ID, '_misc', true ) ); if ( '' != $misc ) { $member_fields .= '<p class="organization" itemprop="affiliation">' . $misc . '</p><!--/.misc-->' . "\n"; } return $member_fields; }
However, this is outputting the new field after the main content of the team member, and in the following html:
<ul class="author-details"> <p class="organization" itemprop="affiliation">Organization Name</p> </ul>
What I’d like to do is have it appear right after the team members name and position. Ideally like so:
<h3 class="member" itemprop="name">Member Name</h3> <p class="role" itemprop="jobTitle">Member Job Title</p> <p class="organization" itemprop="affiliation">Organization Name</p>
Any ideas on how to get this new field to move up in the template?
I tried looking at this code, but have no idea where to place the new field because I’m not sure how to insert it into that %%TITLE%% area:
add_filter( ‘woothemes_our_team_item_template’, ‘new_team_member_template’ );
function new_team_member_template( $tpl ) { $tpl = '<div itemscope itemtype="http://schema.org/Person" class="%%CLASS%%">%%TITLE%% %%AVATAR%% <div id="team-member-%%ID%%" class="team-member-text" itemprop="description">%%TEXT%% %%AUTHOR%%</div></div>'; return $tpl; }
Any help or ideas will be greatly appreciated.
- The topic ‘Change Order of Displaying a Custom Field’ is closed to new replies.