WordPress.org

Support

Support » Plugins and Hacks » TTFTitles help

TTFTitles help

  • hi, i am building a site with the amazing TTFTitles plugin, and i am wondering if there is any way to use it to create images for the page titles in my navigation bar.
    although the plugin is great, the support documentation is a bit brief.

    many thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • I asked my friend Herb how to make ttftitles also work with WordPress menus (using wp_list_pages). He came up with the following code which you can use in place of wp_list_pages in your template.

    <?php
    			$pages = wp_list_pages('sort_column=menu_order&amp;title_li=&amp;depth=1&amp;echo=0');
    			if ($pages) {
    			preg_match_all('/<a.*>(.*)<\/a>/', $pages, $array);
    			$asize = count($array[0]);
    			for($i = 0; $i < $asize; $i++) {
    			$link = $array[0][$i];
    			$title = $array[1][$i];
    
    			ob_start();
    			the_ttftext($array[1][$i], $echo = true, $style="menu primary nav", $overrides="");
    			$ttf = ob_get_clean();
    
    			$originalLink = $link;
    			$link = str_replace(">" . $title, ">" . $ttf, $link);
    			$pages = str_replace($originalLink, $link, $pages);
    			}
    			echo $pages;
    			}
    		?>

    Thanks a lot lclarkberg! this works just fine!

    I’m looking into implementing this right now but can’t seem to get it to stick. It seems to output the normal menu – although the code below is working – just no replacing the titles with the dynamic ttftitle images.
    I’m using an ol instead of the usual ul format list but it should be the same? The ttftitles style is called menu fyi.

    <ol id="dropmenu">
    <?php
    			$pages = wp_list_pages('sort_column=menu_order&title_li=&exclude=2,6&depth=1');
    			if ($pages) {
    			preg_match_all('/<a.*>(.*)<\/a>/', $pages, $array);
    			$asize = count($array[0]);
    			for($i = 0; $i < $asize; $i++) {
    			$link = $array[0][$i];
    			$title = $array[1][$i];
    
    			ob_start();
    			the_ttftext($array[1][$i], $echo = true, $style="menu", $overrides="");
    			$ttf = ob_get_clean();
    
    			$originalLink = $link;
    			$link = str_replace(">" . $title, ">" . $ttf, $link);
    			$pages = str_replace($originalLink, $link, $pages);
    			}
    			echo $pages;
    			}
    		?>
            </ol>

    Thoughts? Thanks

    Hi lotech, is at least one of your ttf styles called menu?

    Is there a way to use another style for subtitles?

    I mean sub pages

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘TTFTitles help’ is closed to new replies.