Title: Hyperlink one field using another field&#039;s data
Last modified: August 21, 2016

---

# Hyperlink one field using another field's data

 *  Resolved [lori-wba](https://wordpress.org/support/users/lori-wba/)
 * (@lori-wba)
 * [12 years, 12 months ago](https://wordpress.org/support/topic/hyperlink-one-field-using-another-fields-data/)
 * This is a great plug-in! Thanks!
 * I’ve searched for an answer to this but can’t find anything: Can I hyperlink 
   one field (a person’s name, for instance) to the URL contained in another field(
   that person’s website)?
 * I think this would *not* be the “Single Record Field” [pdb_single] because I 
   do not want all records to link to the same page. I need them to link to various
   URLs as specified in another field in the database.
 * Thanks again!
 * [http://wordpress.org/extend/plugins/participants-database/](http://wordpress.org/extend/plugins/participants-database/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [Roland Barker](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [12 years, 12 months ago](https://wordpress.org/support/topic/hyperlink-one-field-using-another-fields-data/#post-3843132)
 * OK, well this is slightly complicated, but if you’re good with PHP, no problem.
   Create a custom template for your list (instructions [here](http://xnau.com/work-2/wordpress-plugins/participants-database/pdb-templates/))
   then, set up your code to add the link to the desired field. Inside the top loop
   in the template, you can get the value for any field of a record with “$this-
   >record->fields->FIELD_NAME->value” replacing “FIELD_NAME” with the name of the
   fields you want to get the value of.
 * You would put something like this in your template after the line that has “$
   this->the_field()”. Let’s say you wanted to put the link on the “first_name” 
   field, and the URL is coming from a link field named “website”. Link fields are
   stored as arrays where the first element is the URL, so we have to unserialize
   it to get the array.
 *     ```
       <?php if ($this->field->name == 'first_name') {
          $link_array = unserialize($this->record->fields->website->value);
          $this->field->value = '<a href="'.$link_array[0].'">'.$this->field->value.'</a>';
       } ?>
       ```
   
 * Note that field values will only be available for fields that have been set to
   display in the list.

Viewing 1 replies (of 1 total)

The topic ‘Hyperlink one field using another field's data’ is closed to new replies.

 * ![](https://ps.w.org/participants-database/assets/icon-256x256.jpg?rev=1389807)
 * [Participants Database](https://wordpress.org/plugins/participants-database/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/participants-database/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/participants-database/)
 * [Active Topics](https://wordpress.org/support/plugin/participants-database/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/participants-database/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/participants-database/reviews/)

## Tags

 * [field](https://wordpress.org/support/topic-tag/field/)
 * [hyperlink](https://wordpress.org/support/topic-tag/hyperlink/)

 * 1 reply
 * 2 participants
 * Last reply from: [Roland Barker](https://wordpress.org/support/users/xnau/)
 * Last activity: [12 years, 12 months ago](https://wordpress.org/support/topic/hyperlink-one-field-using-another-fields-data/#post-3843132)
 * Status: resolved