• We need to be able to show the email (as it currently works) or if there is no email link to a URL for a contact page.

    Is there a way that we can do this currently? I’m happy to write some code to make this possible if you have some direction about how you’d like it added to the plugin.

    I realize you are setup so I could override the template and display my own custom frontend view, but I don’t see a way currently to add a field to the admin area of the site and I note that you use sanitize_email as you save the code so we can’t just put a URL in there as it would be sanitized and then not what we want.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Brett Shumaker

    (@brettshumaker)

    Hi Curtis –

    > Is there a way that we can do this currently?

    Admittedly, I don’t have this aspect of the plugin set up as I’d like but this should still be possible using the sslp_replace_formatted_values_filter (assuming you’re using the [staff-email-link] tag). Again, this is suboptimal, but that filter provides an array (non-associative ??) of values that can be changed. The email link is in the 3rd index there. Something like this could work:

    
    function sslp_replace_formatted_values_filter_function( $replace_formatted_values, $post_id ) {
        // If there's an empty mailto link, replace it with a link to the contact page.
        if ( strpos( $replace_formatted_values[3], 'href="mailto:"' ) !== false ) {
            $replace_formatted_values[3] = '<a href="/contact-us" title="Contact Us">Contact Us</a>';
        }
        
        return $replace_formatted_values;
    }
    add_filter( 'sslp_replace_formatted_values_filter', 'sslp_replace_formatted_values_filter_function', 10, 2 );
    

    Let me know if that would work for your use case.

    Thanks!

    Thread Starter curtismchale

    (@curtismchale)

    @brettshumaker not quite. We need to have both fields in the admin area and then I can display whichever one has data. As I said in Slack, I have development time to help build this. I just need direction from you so that I don’t build something you don’t want in the plugin.

    Ideally, I’ll help build, or totally build this feature that you have said in other channels you want to add.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Conditional contact fields?’ is closed to new replies.