Displaying pages and categories with the TTF Titles-plugin
…lets you use images to replace the titles of your posts, thus circumventing the problem of guessing what fonts your end-users might have installed.
I.e. makes it possible for you to use whichever font you desire when creating a theme (at the cost of slightly raising your loading time though). I myself am a complete junkie for the plugin!
If you want to display a graphic menu of your categories and/or pages you can use the following code. (This is not my coding, only a modification of a function provided by a commenter named Ronnie on the TTFTitles-page.)
Categories:
< ?php
$cats = wp_list_categories('depth=1&title_li=&echo=0');
if ($cats)
{
preg_match_all('/]*>(.*)<\/a>/', $cats, $array);
$asize = count($array[0]);
for($i = 0; $i < $asize; $i++)
{
echo "";
the_ttftext($array[2][$i], $echo = true, $style="");
echo "";
}
}
? >
Pages:
< ?php
$pages = wp_list_pages('depth=1&title_li=&echo=0');
if ($pages)
{
preg_match_all('/]*>(.*)<\/a>/', $pages, $array);
$asize = count($array[0]);
for($i = 0; $i < $asize; $i++)
{
echo "";
the_ttftext($array[2][$i], $echo = true, $style="");
echo "";
}
}
? >
(You need to remove the whitespace between the question marks.)
Enjoy!











Anne said:
Hi there! This might be exactly what I need!
I am trying to use this code for pages on a navigation bar and it is just not working. Keeps telling me there is an unexpected = …
Any suggestions?
Anne said:
OK. So I am an idiot and there was an error because I’m an idiot. But now it just isn’t showing up at all.
Sorry for being such a fuss body and thank you for the birthday wishes!
Rahid said:
Sorry, this doesn’t work at all.