DesignMe Creative Group

207.776.5416 • MAINE & ARIZONA

fb pintrest rssicon
  • Home
  • Services
    • Websites & Social Media
    • Marketing & E-Newsletters
    • Logos & Print
    • Training & Support
  • Portfolio
    • Website Design
    • Creative Design & Branding
    • Social Media & E-Marketing
  • The Team
  • Why DesignMe?
    • Our Philosophy
    • Affordable Prices
    • Getting Started
  • Blog
  • Payment
  • Contact

January 20, 2021 By Debbie Leave a Comment

Adding A Shortcode To The Post Title

If you like color like I do, then perhaps you’d want to put a splash of color into your entry titles – kind of like I did above. It’s pretty easy to do:

1. Add the following to your functions.php file

// ADD GREEN SHORTCODE

add_filter( 'the_title', 'do_shortcode' ); // allows shortcode in the title

add_shortcode( 'green', 'green_shortcode' );  // create the shortcode called green

function green_shortcode( $atts, $content = null ) {
return '<span class="green">' . $content . '</span>';
}

2. Add this to your child theme stylesheet:

.green {
color: #b8c973;
}

3. The entry title line looks like this:

Adding A Shortcode To The Post Title

That’s it!

Filed Under: Code Tips, CreativeCorner, Just Because, WordPress

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Site Search

Tech Talk

  • Enqueue CSS2 Google Fonts
  • Redirect to the BuddyPress Profile Page
  • “Going Live”
  • Insert Soliloquy Shortcode Using Advanced Custom Fields
  • Redirect My Website To https://

Creative Corner

  • Unique Websites Deserve a Unique Login
  • Adding A Shortcode To The Post Title
  • Favicons – A Tiny Graphic With Big Impact
  • Social Media Icons – So Many Options!
  • Savage Chicken iMugs

From Our Blog

  • The “ME” In Our Name Really Means YOU
  • Behind Your Website
  • I Have a Website – Now What?
  • Full Width (100%) Section On A Fixed Width Page
  • Small Can Mean Big When It Comes To Websites

View Topics

creative

Functional

affordable

Copyright © 2023 · Custom Website by DesignMe Creative Group · Log in

Hosted Locally by Maine Hosting Solutions