NEW! Download a child theme with the same code already integrated for you. [download id=”12″ format=”2″]
Extending the user profile just got easier. With ClassiPress 3.1 you can now add fields to the user profile directly from your parent theme or child theme functions.php file. Simply add the following code to your functions file and it will automatically give you an additional field for PHONE NUMBER, which should be a critical part of more Classified Ads websites.
add_filter('appthemes_extended_profile_fields', 'sm_add_profile_fields'); function sm_add_profile_fields($fields){ $fields['phone_number'] = array( 'title'=> __('Phone Number:','appthemes'), 'type' => 'text', 'description' => __('Enter your phone number to allow others to easily contact you by phone.','appthemes') ); return $fields; }
Fantastic! Now my users can enter there phone number into there profile. Hey wait a minute. Why isn’t the phone number showing up on the site anywhere except on there edit profile page? Well, that’s because there is a second step. Step 2 of the process is to modify an existing page to enhance it with the new information. In this example we are going to modify the “SINGLE” ad page, where there are 3 tabs next to the add and 1 of them gives the posters information. You would expect to find the phone number of the poster here right? Right!
Now open up, or create in your child theme “sidebar-ad.php”. Next you will want to find the HTML that starts with “<ul class=”member”> and you will want to make it look like this:
The most important part of the above code is the following line:
When your done, the single page should have a sidebar that looks something like this:
© Copyright 2024 Sethmatics Websites All Rights Reserved.
Pingback: Has anything gone wrong while adding phone number
Seth, this is awesome. thank you so much for the download files. I didn’t copy the style.css across because that would have overwritten the previous exercise with the category icons.
My ClassiPress is starting to take shape!
Your very welcome. I’m glad people are finding the tutorials useful.
Seth, I must apologise that I have a yellow triangular head. Please don’t hold that against me! lol.
I’ve re-visited the above tutorial and am doing things differently the second time around. What I am paying attention to now is: what changes can I apply in the Childtheme, with the intention of minimising disruption if I upgrade to a newer version of ClassiPress in the future.
so, I am doing everything possible to apply your suggestions at the child level.
with your instructions above, does this mean I need a complete copy of both /classipress/functions.php and sidebar-ad.php sitting in my child folder? When I do this and make the above additions/mods I get errors that suggest these php files want access to other php documents from the root of /classipress (ie: load.php)
thanks again,
John.
Mr Triangle Head.
Seth, I answered my own question by going back to AppThemes and completing the second tutorial on Child Themes. The above works fine and now I will work on shifting alot of this user detail to the registration screen, where it can be captured once and used many times. I’ll be trying to make this work in the ChildThemes and using alot of the work that dikiyforester did here. http://forums.appthemes.com/how-add-extra-field-user-profile-inherit-26471/
I didn’t quite get Tutorial 2 working, the function you said to look for in Sidebar-ad.php wasn’t there in my version 3.1.8 but that’s ok, I don’t need that functionality on my site and the above example works fine.
thanks again.
John.
Glad you got if figured out. If you find that any parts of the tutorials don’t work because of a ClassiPress update, please let us know so that we can update them to keep them useful to our visitors.
i woult like to also have the option for new people who register to add there phone number in the register form.
So it then will be on there profile page and on the sidebar.
Do you guys have for me a code what i can add in the register form?
I use allready this code above.