Monday, January 7, 2013

Font face, find posts


Things I have learned on the 01/7

To use a custom font in html, us coufon or font face.

@font-face
{
font-family: 'MyWebFont';
src: url ('webfont.eot'); /* IE9 Compat modes */
src: url (webfont.eot?#iefix) format ('embedded-opentype'), /* Other IE versions */
url ('webfont.woff') format('woff'), /* Modern Browsers */
url ('webfont.ttf') format('truetype'), /* Safari, Android, iOS */
url ('webfont.svg#svgFontName') format ('svg'); /* Legacy iOS */
}

body {
font-family: 'MyFontFamily', Fallback, sans-serif;
}

How to use font-face
http://css-tricks.com/snippets/css/using-font-face/

Find the posts and check if there are any in var.
<?php $test = get_posts('category_name=test');
if ($test)
{

}
?>

- MichealH

My modified method to set based on whether there are posts on the page.

<?php $hasposts = get_posts('category_name=events');
if ($hasposts)
{ ?>
<script language="javascript">
document.getElementById("menu-item-184").className = "events";
</script>
<?php }
else { ?>
<script language="javascript">
document.getElementById("menu-item-184").className = "events2";
</script>
<?php }
?>

No comments:

Post a Comment