• Resolved autox420

    (@autox420)


    echo get_the_title();

    How do i color this directly with code?
    I know i can use style.css but i need titles to be colored only in one plugin and it doesnt have .css and i also dont want to add .css to it.

    Is it possible?
    Im thinking something like this but maybe u know the correct way to do it?

    <font color="#yellow">echo get_the_title();</font>

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    <span class="my-title"><?php echo get_the_title(); ?></span>

    in your CSS

    span.my-title {
       color: yellow;
    }

    You can add styles inline too-

    <span style="color:yellow;"><?php echo get_the_title();?</span>

    But it’s worth noting that if you are using a third party plugin (meaning, you didn’t build it), any changes you make to the plugin will be overwritten if you ever update it. In that case, Steve’s suggestion is your best bet, and you’ll probably want to add the style the your theme’s CSS.

    Thread Starter autox420

    (@autox420)

    Both worked. But the second one hade little error so others know.

    <span style="color:yellow;"><?php echo get_the_title();?></span> You forgot about ”>”

    Hello,
    Indent your code in below way.

    
    <span style="color:yellow;">
    	<?php echo get_the_title(); ?>
    </span>
    

    Hope this will solve.
    thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Title color directly in PHP’ is closed to new replies.