WordPress.org

Ready to get started?Download WordPress

Forums

TTF Titles
Using in Pages and Posts - solution! (1 post)

  1. muksmuks
    Member
    Posted 2 years ago #

    Since the older post (http://wordpress.org/support/topic/plugin-ttf-titles-using-in-pages-and-posts?replies=3) has been closed, I'm posting here now. I wanted to share a solution for anyone who is still looking for shortcode-compatibility of TTFTitles.

    The problem with ttiefenbach's code was a limit to WordPress' shortcode-function. As it says in the docs (http://codex.wordpress.org/Function_Reference/add_shortcode) , you're not allowed to 'echo' content within the function. Instead, you have to 'return' it. Here's a working code for functions.php:

    function the_ttftext_shortcode( $atts ) {
       extract( shortcode_atts( array(
          'text' => '',
          'echo' => false,
          'style' => '',
          'overrides' => '',
          ), $atts ) );
    
       return the_ttftext (esc_attr($text), false, esc_attr($style), esc_attr($overrides));
    }
    add_shortcode('ttf_text', 'the_ttftext_shortcode');

    Now you should be able to use a shortcode for TTFTitles like this:
    [ttf_text text="Hello World!" style="basic"]

    cheers,
    Micha

    http://wordpress.org/extend/plugins/ttftitles/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic