Skip to content
This repository was archived by the owner on May 18, 2025. It is now read-only.
This repository was archived by the owner on May 18, 2025. It is now read-only.

woothemes_our_team_item_template does not work with every field #64

Description

@angelo-moreira

Good morning,

I was trying to display contact_email with a custom template such as:

    add_filter( 'woothemes_our_team_item_template', 'new_team_member_template' );
    function new_team_member_template( $tpl ) {
        $tpl = '<li itemscope itemtype="http://schema.org/Person" class="%%CLASS%%">%%AVATAR%% %%TITLE%% %%CONTACT_EMAIL%% <div id="team-member-%%ID%%"  class="team-member-view-more" itemprop="description"><a href="%%PROFILE_URL%%" class="readProfile">Read more</a><div class="team-member-text">%%TEXT%%</div></div></li>';
    return $tpl;
    }

But CONTACT_EMAIL didn't work

So I tried to find out what was going wrong, and made the following change in whoothemes-our-team-template.php

line 174 I saw this:

                    if ( true == $args['contact_email'] && '' != $post->contact_email && apply_filters( 'woothemes_our_team_member_contact_email', true ) ) {
                        $member_fields .= '<li class="our-team-contact-email" itemprop="email"><a href="mailto:' . esc_html( $post->contact_email ) . '">' . __( 'Email ', 'our-team-by-woothemes' ) . get_the_title() . '</a></li>';
                    }

and changed it to this:

                    if ( true == $args['contact_email'] && '' != $post->contact_email && apply_filters( 'woothemes_our_team_member_contact_email', true ) ) {
                        $member_fields .= '<li class="our-team-contact-email" itemprop="email"><a href="mailto:' . esc_html( $post->contact_email ) . '">' . __( 'Email ', 'our-team-by-woothemes' ) . get_the_title() . '</a></li>';
                        $template = str_replace( '%%CONTACT_EMAIL%%', '<a href="mailto:'.esc_html( $post->contact_email ).'">'.esc_html( $post->contact_email ).'</a>', $template );
                    }

Now I can retrieve contact_email on my template, Is this the right way to change it or should it not be wrap around that if condition?

If this is ok is it worth to push these changes?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions