Title: Add Cell Number
Last modified: August 31, 2016

---

# Add Cell Number

 *  Resolved [neilgee](https://wordpress.org/support/users/neilgee/)
 * (@neilgee)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/add-cell-number/)
 * Hi Nate,
 * I was looking to add a cell number as a unique field – I found this gist and 
   was hoping to work from it [https://gist.github.com/NateWr/b28bb63ba8a73bb14eac](https://gist.github.com/NateWr/b28bb63ba8a73bb14eac)
 * But can’t get the example fields to appear when I activate the plugin as is –
   is the code still valid for this version?
 * [https://wordpress.org/plugins/business-profile/](https://wordpress.org/plugins/business-profile/)

Viewing 9 replies - 1 through 9 (of 9 total)

 *  [NateWr](https://wordpress.org/support/users/natewr/)
 * (@natewr)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/add-cell-number/#post-7021265)
 * Hi Neil,
 * Looks like there were a couple errors due to copy-pasting some code. I’ve updated
   the Gist now if you want to try the new version.
 * You’ll probably need to do some further wrangling depending on your needs. When
   I tested just now, the fax field appeared at the bottom and with an odd icon.
 *  Thread Starter [neilgee](https://wordpress.org/support/users/neilgee/)
 * (@neilgee)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/add-cell-number/#post-7021337)
 * Great – works now – so I’ll have a go at it!
 *  Thread Starter [neilgee](https://wordpress.org/support/users/neilgee/)
 * (@neilgee)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/add-cell-number/#post-7021346)
 * I got it to work and included my store and mobile fields – question I have now
   is how can i move my mobile number field to be after the main number field.
 * I tried to alter it via the shortcodes but the mobile gets output last
 * [https://gist.github.com/neilgee/19859a58e6b24f25c604](https://gist.github.com/neilgee/19859a58e6b24f25c604)
 *  [NateWr](https://wordpress.org/support/users/natewr/)
 * (@natewr)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/add-cell-number/#post-7021349)
 * Hi Neil,
 * You’ll need to rebuild the array with the order of callbacks that you want. That
   will look something like this (untested);
 *     ```
       function hcbp_component_callbacks( $callbacks ) {
       	global $bpfwp_controller;
       	if ( $bpfwp_controller->settings->get_setting( 'mobile' ) ) {
       		$new_callbacks = array();
       		foreach( $callbacks as $key => $val ) {
       			$new_callbacks[$key] = $val;
   
       			// When you find the element you want to place it after,
       			// slot it in.
       			if ( $key == 'phone' ) {
       				$callbacks['mobile'] = 'hcbp_print_mobile';
       			}
       		}
   
       		$callbacks = $new_callbacks;
       	}
       	return $callbacks;
       }
       add_filter( 'bpwfwp_component_callbacks', 'hcbp_component_callbacks' );
       ```
   
 * Beware that if no `phone` value exists the `mobile` field will never be added.
   A more sophisticated way to do this is to use [array_slice()](http://us3.php.net/manual/en/function.array-slice.php).
 *  Thread Starter [neilgee](https://wordpress.org/support/users/neilgee/)
 * (@neilgee)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/add-cell-number/#post-7021366)
 * Hi Nate – thanks for the snippet, I replaced the existing hcbp_component_callbacks
   function with it but it doesn’t output the new field in any place.
 *  [NateWr](https://wordpress.org/support/users/natewr/)
 * (@natewr)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/add-cell-number/#post-7021377)
 * Hi Neil,
 * I haven’t tested the code at all so you’ll need to pick through to find the problem.
   Are you comfortable debugging PHP code?
 * You’ll probably want to add some logging details to each conditional to see where
   the code is ending early.
 *  Thread Starter [neilgee](https://wordpress.org/support/users/neilgee/)
 * (@neilgee)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/add-cell-number/#post-7021390)
 * Hi Nate,
 * I tried with [array_splice](http://uk.php.net/manual/en/function.array-splice.php#92651)
   not not much success there (probably my skill level more than anything).
 * I looked at your code again, if I `var dump` your `$callbacks` I can see the 
   key and value for the new mobile pair but it’s sitting on the end of the array.
 * I tried to recreate the array in the order I want and return that but eventhough
   the order is now correct it is displaying the email and map fields even when 
   I have them not appearing, so this is not the right approach.
 *  [NateWr](https://wordpress.org/support/users/natewr/)
 * (@natewr)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/add-cell-number/#post-7021392)
 * I see the typo in my code. The line where it adds the mobile callback:
 *     ```
       $callbacks['mobile'] = 'hcbp_print_mobile';
       ```
   
 * Is wrong. It should add it to the NEW array:
 *     ```
       $new_callbacks['mobile'] = 'hcbp_print_mobile';
       ```
   
 *  Thread Starter [neilgee](https://wordpress.org/support/users/neilgee/)
 * (@neilgee)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/add-cell-number/#post-7021396)
 * Yes that’s it working great now – many thanks.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Add Cell Number’ is closed to new replies.

 * ![](https://ps.w.org/business-profile/assets/icon-128x128.png?rev=2205555)
 * [Five Star Business Profile and Schema](https://wordpress.org/plugins/business-profile/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/business-profile/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/business-profile/)
 * [Active Topics](https://wordpress.org/support/plugin/business-profile/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/business-profile/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/business-profile/reviews/)

 * 9 replies
 * 2 participants
 * Last reply from: [neilgee](https://wordpress.org/support/users/neilgee/)
 * Last activity: [10 years, 3 months ago](https://wordpress.org/support/topic/add-cell-number/#post-7021396)
 * Status: resolved