Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

woothemes_our_team_item_template does not work with every field #64

Open
angelo-moreira opened this issue Sep 1, 2015 · 0 comments
Open
Labels

Comments

@angelo-moreira
Copy link

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?

@mattyza mattyza added the bug label Aug 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants