One of the "hidden" features of oUF 1.2 was recursive calling of the style function on objects spawned from a header. This made it deadly simple to spawn paryt(pet|target)s.
The following is a slightly modified version of what's in oUF.xml. You'll still have to modify it to your needs.
Code:
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/../FrameXML/UI.xsd">
<Button name="oUF_RenameMeSomethingUnique" inherits="SecureUnitButtonTemplate" hidden="true" virtual="true">
<Frames>
<Button name="$parentTarget" inherits="SecureUnitButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent"/>
</Anchors>
<Attributes>
<Attribute name="unitsuffix" type="string" value="target"/>
<Attribute name="useparent-unit" type="boolean" value="true"/>
<Attribute name="type1" type="string" value="target"/>
<Attribute name="initial-unitWatch" type="boolean" value="true"/>
</Attributes>
</Button>
</Frames>
</Button>
</Ui>
In your layout all you have to do is:
Code:
header:SetAttribute("template", "oUF_RenameMeSomethingUnique")