Support » Plugins » Hacks » Creating Default Text for Custom Theme Options

  • This is kinda urgent if someone could help me out ASAP, that would be majorly AWESOME!

    Basically, I used the default template found in the codex section titled Creating Options Pages (, and it works fine and dandy, but currently it doesn’t have some sort of a default text for the fields. For example, here is my code on the homepage:

    <div id="header">
        	<h1 class="center font-georgia">
    			<?php echo get_option('headline_one'); ?>

    I know somehow I could just use a code to check if headline_one has any content, and if it doesn’t, display this text. Else if it does, display the headline_one text.

    I just can’t do this myself, not much of a PHP coder, I can just copy and paste codes to make them work so if someone could whip up that code for me quick that would be great and I would appreciate it very much.

    Thanks in advance!

Viewing 1 replies (of 1 total)
  • Actually, I fixed this myself. This is the code I used for reference if anyone else might need it:

            	$headline_one = get_option('headline_one');
    			if($headline_one == "") {
    				echo "<h1 class=\"center font-georgia\">This is the default text for the first headline and you can't change that. Well actually, you can in the options panel now! Weeeeeeeee!</h1>";
    			} elseif($headline_one != "") {
    				echo "<h1 class=\"center font-georgia\">" . get_option('headline_one') . "</h1>";
Viewing 1 replies (of 1 total)
  • The topic ‘Creating Default Text for Custom Theme Options’ is closed to new replies.