WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Connections] Hide "Work" from Work Phone, Work Email, etc in template (11 posts)

  1. xavierverhoeven
    Member
    Posted 3 years ago #

    After trying many different business directory type plugins, I found Connections was the best one for the job. And the $15 CSV importer made life very easy to upload all the businesses. The only problem is that I don't want the phone number, fax number and email labelled as "Work Phone", "Work Fax" and "Work Email". IE. I want to just display "Phone", "Fax", and "Email".

    Is there any way I can change this in the plugin? I found instances of them in one of the files and made modifications, but they only showed in the backend.

    I got around the issue for Address by changing to "Select" rather than a type of address, but it could be nice to have a more elegant solution there too.

  2. shazahm1
    Member
    Posted 3 years ago #

    The best way of handling this is to create a custom template to display the data as you wish.

    To get an idea at how they're built, so the templates in the
    wp-content/connections/templates folder.

    Now those templates use the code that outputs preformatted HTML blocks but you are not restricted to using them. You can copy out the methods in the class.ouput.php file and paste them into the template, formatting how you wish. Just make sure to change all instances of $this to $entry.

    As a service I do provide custom templates which can be requested thru the help desk form at connections-pro.com.

  3. xavierverhoeven
    Member
    Posted 3 years ago #

    Thanks for the advice Steven. I still can't figure it out though.

    I've got my custom template set up exactly as I want - I just need to remove the word Work from Phone and Fax. I've managed to get Email to format by overwriting the code to always give Email no matter what type it is. This won't work for the phone/fax, however, as they're both 'phone types'.

    Could you advise how I can split these up? If that even makes sense... I'm fairly new to all this.

  4. shazahm1
    Member
    Posted 3 years ago #

    Try this [not tested]:

    if ($entry->getPhoneNumbers())
    {
    	echo '<div class="phone-number-block" style="margin-bottom: 10px;">' . "\n";
    	foreach ($entry->getPhoneNumbers() as $phone)
    	{
    
    		switch ($phone->type)
    		{
    			case 'homephone':
    				$phone->name = "Phone";
    				break;
    			case 'homefax':
    				$phone->name = "Fax";
    				break;
    			case 'cellphone':
    				$phone->name = "Cell Phone";
    				break;
    			case 'workphone':
    				$phone->name = "Phone";
    				break;
    			case 'workfax':
    				$phone->name = "Fax";
    				break;
    			case 'fax':
    				$phone->name = "Fax";
    				break;
    		}
    
    		//Type for hCard compatibility. Hidden.
    		if ($phone->number != null) echo  '<strong>' . $phone->name . ':</strong> <span class="tel">' . $entry->gethCardTelType($phone->type) . '<span class="value">' .  $phone->number . '</span></span><br />' . "\n";
    	}
    	echo '</div>' . "\n";
    }
  5. xavierverhoeven
    Member
    Posted 3 years ago #

    Thanks Steven, that does exactly what I want!

  6. fringer
    Member
    Posted 3 years ago #

    I have a similar problem - I've changed the values in options class.optionc, translating work phone and work email to my language, but, and this is very odd, work phone displays translated and work email does not.

    Any ideas? Or, could you tell me what the code for sepcific types is - instead of whole email block, how would I add just the work email to the template?

    I'm thinking of constructing this kind of template:

    Name: <?php echo $entry->getFullLastFirstName() ?>
    Organization: <?php echo $entry->getOrganization() ?>
    Position: <?php echo $entry->getTitle() ?>

    Email: <?php echo getWORKEMAIL() ?>

  7. fringer
    Member
    Posted 3 years ago #

    Hehe, got it, it was in class.entry

  8. xplicitone
    Member
    Posted 2 years ago #

    I'm trying to figure out this because I would like to change home ___,work __ and cell___ to just simple choices of Phone, Email, Address.

    Since I'm using the cMap template, I duplicated the folder and called it cMap_changes. So I should copy the class.ouput.php from /wp-content/plugins/connections/includes and place a saved version of it in /wp-content/connections_templates/cmap_changes???

    And complete the changes in that file. or should I copy the contents of class.output.php and place it in the /cMap_changes/template.php?

    I'm sorry If I lost you but I am really trying to understand this, I'm in the process of typing in 200+ entries.

    Thanks again in advance,

    Sorry for the headache

  9. shazahm1
    Member
    Posted 2 years ago #

    @xplicitone

    If you're using the cMap 2.0 template, you do not need to edit any files. Just use the following shortcode:

    [connections str_home_phone='Phone' str_home_fax='Fax' str_cell_phone='Cell' str_work_phone='Phone' str_work_fax='Fax' str_personal_email='Email' str_work_email='Email']

  10. hometrends
    Member
    Posted 2 years ago #

    I am using the Market 1.0 template. I was able to modify what the Phone and Email labels say (removing work, home, etc) but I can't figure out how to remove the Address label (home, work, school, other). I would like to be able to remove the label all together or at least change it so it says "Location" or "Address" instead.

  11. shazahm1
    Member
    Posted 2 years ago #

    @hometrends

    I recommend upgrading to Market 2.0.x which is free and can be accessed using the same download link and code used to download Market 1.0. Once you have upgraded you can make these changes easily by setting options in the Connections shortcode.

    Market as over 60 options that can be set in the Connections shortcode. Please take a look at the Customization Options tab on the Market template product page, http://connections-pro.com/templates/market/

    For example, to remove the address label:
    [connections addr_format='%line1% %line2% %line3% %city%, %state% %zipcode%']

    See this FAQ for more details of the addr_format option:
    http://connections-pro.com/faqs/how-do-i-use-the-addr_format-shortcode-option/

Topic Closed

This topic has been closed to new replies.

About this Topic