Community Forums › Forums › Archived Forums › Design Tips and Tricks › How to create and reuse a word in H3 format?
- This topic has 7 replies, 2 voices, and was last updated 11 years, 4 months ago by
pamrburke.
-
AuthorPosts
-
November 16, 2013 at 3:13 pm #73456
pamrburke
MemberIn my site title I have formatted it canwillDONE, such that can is gray, will is orange, and DONE is a very dark gray.
There will be times that I will use canwillDONE in a H3, such as canwillDONE Mission, and I want canwillDONE to be formatted like above, but all the other words in the H3 to the default body color. Is using the dashboard text area the only way to do this, or is it something that can be programmed in the function.php, then have a CSS created for it?
Thanks
Pam
http://www.canwilldone.comNovember 16, 2013 at 11:30 pm #73517nutsandbolts
MemberYou could create a shortcode for it. Put this in your functions.php:
// Custom canwillDONE Text function canwilldone_shortcode() { return '<h3><span style="color: #019192;">can</span><span style="color: #017172;">will</span><span style="color: #ED702B;">DONE</span></h3>'; } add_shortcode( 'canwilldone', 'canwilldone_shortcode' );
Be sure to change each color value above to the correct hex codes for the colors you want. Then you can use
[canwilldone]
in a page or post and it will display as an H3 with the correct colors.Edited to add: This won't work in an entry title, but only as a heading within a page or post. Also, if you want to be able to choose whether or not it displays as H3 or regular-sized text, just take the H3 tags out of the function.
Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
I provide development and training services for designers • Find me on Twitter and Google+November 17, 2013 at 10:30 am #73565pamrburke
MemberThank You Andrea for responding.
I added the code to the function area of the Gensis Extender, but there was no change to the text.
I will also note that I have another function in there for something else, but I gather that should not make a difference.
Thanks
Pam
November 17, 2013 at 10:31 am #73566nutsandbolts
MemberIt won't automatically change existing text - you would need to use the shortcode above in a page or post to see if it's working. It worked on a test site for me with no problem. Can you paste exactly what you put in your functions area?
Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
I provide development and training services for designers • Find me on Twitter and Google+November 17, 2013 at 11:38 am #73571pamrburke
MemberHi Andrea,
Thank You for your help. I got it to work. I am new to all of this, therefore I did not know what shortcodes was.
After a Google search to learn more about shortcode, I went back to where I had canwilldone, and replaced it with [canwilldone].
November 17, 2013 at 11:46 am #73573pamrburke
MemberAndrea,
I thought this was resolved, but then realized an issue.
The code is putting the word on its own line, a break after the text before it and a break after the code after it.Thanks
Pam
November 17, 2013 at 1:22 pm #73670nutsandbolts
MemberOkay. Take the code I gave you out of functions.php and replace it with this:
// Custom canwillDONE Text function canwilldone_shortcode() { return '<span style="color: #019192;">can</span><span style="color: #017172;">will</span><span style="color: #ED702B;">DONE</span>'; } add_shortcode( 'canwilldone', 'canwilldone_shortcode' );
That removes the H3 tags, so when you use the shortcode, you'll need to highlight it and make it H3 manually if you want it to be a headline. That will prevent it from adding the line breaks on its own.
Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
I provide development and training services for designers • Find me on Twitter and Google+November 17, 2013 at 2:30 pm #73793pamrburke
MemberAndrea,
That work.
Thank You.
Pam
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.