Displaying pages and categories with the TTF Titles-plugin

The TTFTitles 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!

  • TwitThis
  • Facebook
  • Bloggy
  • Pusha
  • Digg
  • del.icio.us
  • StumbleUpon

"Displaying pages and categories with the TTF Titles-plugin" has 3 Comments:

Drop a comment

Required fields are marked with *.
Your email-adress will not be shown publicly.