Adding email addresses to Divi’s “person” module for District 101

The Divi theme is powerful, but it has some quirks. One of those is in the “person” module, which doesn’t provide a place for contact information (phone and email). I wanted to add email for the people listed on the District Leadership Team page; the obvious way was to add the email address to the text for each person, but that felt inelegant.

A quick Google search led me to a free plugin, Person Module Extended by Dani Dwiputra, made available through Divi Space. I installed the plugin, added emails in the appropriate fields, and could have called it a day, except that I wanted to make some changes to the presentation.

Here are the diffs to get the results I wanted:

++ Desktop/person-full-social/dd-person-modules.php 2016-07-24 21:12:21.000000000 -0700
@@ -465,2 +465,12 @@

+        if ( '' !== $member_email ) {
+            $contact = sprintf('<a href="mailto:%1$s" class="et_pb_member_email">%1$s</a>', esc_html( $member_email ) );
+            $contact .= ( '' !== $member_phone ? sprintf(' | <a href="tel://%1$s" class="et_pb_member_phone">%1$s</a>', esc_html( $member_phone ) ) : '' );
+        } else {
+            $contact = ( '' !== $member_phone ? sprintf('<a href="tel://%1$s" class="et_pb_member_phone">%1$s</a>', esc_html( $member_phone ) ) : '' );
+        }
+        if ( '' !== $contact ) {
+            $contact = '<p>' . $contact . '</p>';
+        }
+
        $output = sprintf(
@@ -471,4 +481,4 @@
                    %8$s
+                   %7$s
                    %1$s
-                   <p>%7$s  |  %6$s</p>
                    %9$s
@@ -483,3 +493,3 @@
            ( '' !== $member_phone ? sprintf( '<a href="tel://%1$s" class="et_pb_member_phone">   %1$s</a>', esc_html( $member_phone ) ) : '' ),
-           ( '' !== $member_email ? sprintf( '<a href="mailto:%1$s" class="et_pb_member_email">   %1$s</a>', esc_html( $member_email ) ) : '' ),
+           $contact,
            ( '' !== $position ? sprintf( '<p class="et_pb_member_position">%1$s</p>', esc_html( $position ) ) : '' ),
@@ -493,2 +503,2 @@
 }
-new DD_Builder_Module_Team_Member;
\ No newline at end of file
+new DD_Builder_Module_Team_Member;
diff -r -U1 Downloads/person-full-social/module-extend.php Desktop/person-full-social/module-extend.php
--- Downloads/person-full-social/module-extend.php  2016-07-20 10:58:09.000000000 -0700
+++ Desktop/person-full-social/module-extend.php    2016-07-24 21:15:17.000000000 -0700
@@ -9,2 +9,3 @@
  * License: GPL2
+ * Modified by David Singer, webmaster@d101tm.org
  */

Thanks, Dani!

This entry was posted in Life. Bookmark the permalink.

Comments are closed.