songololo
songololo

Reputation: 4954

CSS styling won't work on php function. (Wordpress)

I can't get CSS styling to work on content returned from a wordpress php function:

<span id="featured-excerpt"><?php the_excerpt(); ?></span>

The CSS style will work for anything before or after the php for excerpt, but the excerpt itself refuses to be styled. The only way I seem to have any success is where I try to place the php inside the span tag, which hardly seems correct, and creates a new single-space blank line after the php ouput....

<span id="featured-excerpt" <?php the_excerpt(); ?></span>

Any pointers would be appreciated.

Upvotes: 2

Views: 1402

Answers (2)

Worddss Infotech
Worddss Infotech

Reputation: 35

the_excerpt functions is returned with paragraph tags. The best easy solution is call the_content function instead of the_excerpt

the_content provide all css you add in content box.

Upvotes: 1

nickhar
nickhar

Reputation: 20853

In which case... Just looked at: http://codex.wordpress.org/Function_Reference/the_excerpt

It's entirely valid to:

<span id="featured-excerpt"><?php the_excerpt(); ?></span>

or

<div id="featured-excerpt"><?php the_excerpt(); ?></div>

EDIT (and given the comments):

Try removing the php function and render text, that way we'll know if this is a style or function issue:

<span id="featured-excerpt">Lord help us!</span>

How does it display? Does it display in your HTML output?

Upvotes: 1

Related Questions