I am developing a wordpress website and I am trying to figure out how I can add a text color option in the backend for posts and pages. I have a banner image for each page/post, which has the title text of the post on top of it. The problem is that some images are white backgrounds and some are black… so I can’t just say make the post title text white, because it will conflict when the image has a white background… is there a way I can give the client the option to change the title text color when he creates a post? Like add a title text color custom meta box within a post/page?
There are a number of ways you could do this, but the simplest (less code) would be to make 2 page templates. On one template have the title area wrapped in “div a” for example, and then the other page template wrapped in “div b”.
“div a” could be the one with the black background and “div b” could have the white background. Then in your stylesheet you could make the text color for “div a” be whatever and then for “div b” whatever…
Here is some info on making page templates:
that didn’t really help me. the code is in my header.php file, as div id #banner image. and i have a good “if” statement telling it to show slideshow on front page, if else show the featured image on a post/page, as well as the title of the post or page… i have figured out how to create a custom meta box in the backend, and name it “Text Color & Position”… I have given it 2 fields (color and position) which are select buttons for “Blue, Black, White” and “TopLeft, TopRight, BottomLeft, BottomRight”…. now I need to figure out how to implement the “get_post_meta(post->ID, ‘color’)…
- The topic ‘Change Text Color for Posts and Pages’ is closed to new replies.