Scenario: Client wants hypertext links to be white on only one of the Website’s pages, so they display nicely on the dark back ground. The hypertext links for the rest of the site are fuchsia, via CSS.

Problem: Adding hypertext to a WordPress page in Edit Page view, then changing it’s color to white (so it displays nicely on a dark back ground on the front-end of the site) makes it impossible to actually see when you’re trying to edit it in the Edit Page view. Unless you switch to HTML mode – which is a pain in the ass for the client.

Solution: WordPress Custom Fields just on that one page.

NOTE: This only works for a WordPress “page.”

Here’s exactly what I did:

1. Add the below PHP to the header.php file, anywhere between the <head> and </head> tags:

<?php if (is_page()) {
$css = get_post_meta($post->ID, ‘css’, true);
if (!empty($css)) { ?>
<style type=”text/css”>
<?php echo $css; ?>
</style>
<?php }
} ?>

2. Then, in the Custom Fields in your Edit Page view, add the following info:

In the “Name” field type: css
In the “Value” field type: a:link, a:visited {color: #FFFFFF;} a:hover, a:active {color: #FF00FF; text-decoration: underline;}

WordPress Custom Fields

WordPress Custom Fields

3. Working examples:

  • http://test.toryclark.com/press
  • http://toryclark.com/press