So just create the button without that template, and create icons and/or font strings as desired:
Code:
-- Create the button:
local button = CreateFrame("Button", name, parent, "SecureActionButtonTemplate")
button:SetSize(30, 30)
-- Add the icon:
local icon = button:CreateTexture(nil, "ARTWORK")
icon:SetAllPoints(true)
icon:SetTexture("Interface\\TargetingFrame\\UI-RaidTargetingIcon_6")
button.icon = icon
-- Set scripts etc.
Code:
-- Create the button:
local button = CreateFrame("Button", name, parent, "SecureActionButtonTemplate")
button:SetSize(15, 45)
-- Add a font string:
local text = button:CreateFontString(nil, "OVERLAY")
text:SetPoint("CENTER")
text:SetText("Blue Square")
button.text = text
-- Set scripts etc.
On a side note, there is no benefit to upvaluing
CreateFrame, since if you are calling it enough to matter, you're doing something horribly wrong; and when you're upvaluing global functions, for the sake of readability you should keep the full name, eg:
Code:
-- Do this:
local CreateFrame = CreateFrame
-- NOT this:
local CF = CreateFrame
Addons aren't macros or text messages with limited character space. You don't need to condense everything to the fewest possible characters. Imagine that you take 6 months off from coding, and then come back and read your code -- if you'd be confused by your variable name, you shouldn't use that variable name in the first place. This is especially true for API functions, which already
have names; giving them different names doesn't provide any benefit, but does create confusion.