Use get_option to retrieve date format (3 posts)

  1. ces-design
    Posted 2 years ago #

    Hi there,

    I'm trying to code the date into my header.php tagline - the self-updating kind :) The tagline isn't a php echo; it's a get_option -- specifically this:

    <div id="container">
    	   <?php $header_caption = get_option('tz_header_caption');
    	    if( !empty( $header_caption ) ) { ?>
    	    <!-- BEGIN #header-top -->
            <div id="header-top">
                <p><?php echo stripslashes($header_caption); ?></p>
            <!-- END #header-top -->'
    And in theme-options.php, this is the corresponding code:
    '$options[] = array( 'name' => __('Header Caption', 'framework'),
                        'desc' => __('Enter a message to display above your navigation', 'framework'),
                        'id' => $shortname . '_header_caption',
                        'std' => '',
                        'type' => 'textarea');

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

    I am certain that I need to adjust the theme-options.php, because initially all I did was to replace 'tz_header_caption' in the header.php snippet with 'date_format'. But all that did was give me a tagline that said m/d/y.

    So, how do I make this work?

    Thank you,


  2. ces-design
    Posted 2 years ago #

    *and by m/d/y, I mean, "m/d/y" just like that. Not an actual date.

  3. Ctrl-C
    Posted 2 years ago #

    Use PHP function date, i.e.
    <?php echo date($stripslashes($header_caption)); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic