WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

While my related question on Stack Overflow should explain the basic CSS for this once it gets answered, how would I define a custom font family for a wordpress blog that will only apply to a <span> and will not affect the site-wide font families being used by the theme on my wordpress site?

Related: Creating Useable Custom Font Family

share|improve this question
up vote 1 down vote accepted

You can use this function: http://codex.wordpress.org/Function_Reference/body_class

Use this in your header.php

<body <?php body_class(); ?>>

This gives each page a different class and so you can use CSS to set the font-family for a specific page like so:

body.blog span.yourClassName{ font-family:; }

Then of course the is also the jQuery solution using the .children() function

share|improve this answer
Are you saying you want to apply classes to all elements within a specified element, or? – marcup Aug 22 '12 at 19:31
If you look at the code above closely you will see that the CSS rule selects all span's with a class of .yourClassName within the blog page only. – marcup Aug 22 '12 at 19:35
marcup, i had old information, you appeared to have edited, so that answers my question. Thanks! :) – Thomas Ward Aug 22 '12 at 19:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.