Profile2 Page Title Structure
We’ve found a simple solution to the issues many are having with setting the page title pattern w/o the use of Entity Tokens or other modules - for anyone interested, all you’ll need is profile2 installed. It can be difficult to print profile2 fields anywhere other than user-profile.tpl.php - so what you can do to set / change your page title pattern for a user profile (i.e. If you want your title to be something like "Profile2 Field | Site Name"). So I did the following:
- Duplicate html.tpl.php and rename it html--user.tpl.php
- Strip tags from html--user.tpl.php - this should cause the URL to be the page title (default).
- Add tags to user-profile.tpl.php
- Set your profile2 field to print within the title tags.
- Reload profile page and see the changes.
Example:
<title><?php print $profile['profile_type']->field_name['und'][0]['value'] ?> | Site Name</title>
Conclusion:
This may not be the most "valid" way of doing it, but after trying a number of different solutions posted on various forums, I made my own solution. It's quick / dirty, but it works like a charm.
Tweet @blacklimemedia w/ any questions or comments.












