Adding date and author in Fearless Flyer's "Resolution" theme
-
Hello,
If anyone knows how I can add the date and author’s name to each post on the front page for this blog – mediamargins.net – which is the “Resolution” theme, that would be great. Here’s the code from functions.php —
<?php
//menu
add_theme_support( ‘menus’ );
add_action( ‘init’, ‘register_my_menu’ );
function register_my_menu() {
register_nav_menu( ‘primary-menu’, __( ‘Primary Menu’ ) );
register_nav_menu( ‘top-menu-1’, __( ‘Top menu Left’ ) );
register_nav_menu( ‘top-menu-2’, __( ‘Top menu Right’ ) );
}
//post thumbnail
if ( function_exists( ‘add_theme_support’ ) ) {
add_theme_support( ‘post-thumbnails’ );
}
//take out elipsis
function trim_excerpt($text) {
return rtrim($text,'[…]’);
}
add_filter(‘get_the_excerpt’, ‘trim_excerpt’);
//take out excerpt
function getTheExcerpt(){
$tempcontent = get_the_content();
$tempseek = ‘[noexcerpt’;
$temppos = strpos($tempcontent,$tempseek);
if($temppos !== false) {
return ”;
} else {
return the_excerpt();
}
}
function noexcerpt(){
return false;
}
add_shortcode(‘noexcerpt’, ‘noexcerpt’);
//sidebars
add_action(‘widgets_init’, ‘my_register_widget_areas’ );
function my_register_widget_areas(){
register_sidebar(array(
‘id’ => ‘footer-col1’,
‘name’=>’footer column 1’,
‘description’ => ‘these widget areas are located in the footer’,
‘before_widget’ => ‘<div class=”footer-widget first”>’,
‘after_widget’ => ‘</div>’,
‘before_title’ => ‘<h3>’,
‘after_title’ => ‘</h3>’
));
register_sidebar(array(
‘id’ => ‘footer-col2’,
‘name’=>’footer column 2’,
‘description’ => ‘these widget areas are located in the footer’,
‘before_widget’ => ‘<div class=”footer-widget second”>’,
‘after_widget’ => ‘</div>’,
‘before_title’ => ‘<h3>’,
‘after_title’ => ‘</h3>’
));
register_sidebar(array(
‘id’ => ‘footer-col3’,
‘name’=>’footer column 3’,
‘description’ => ‘these widget areas are located in the footer’,
‘before_widget’ => ‘<div class=”footer-widget third”>’,
‘after_widget’ => ‘</div>’,
‘before_title’ => ‘<h3>’,
‘after_title’ => ‘</h3>’
));
register_sidebar(array(
‘id’ => ‘footer-col4’,
‘name’=>’footer column 4’,
‘description’ => ‘these widget areas are in the sidebar’,
‘before_widget’ => ‘<div class=”footer-widget fourth”>’,
‘after_widget’ => ‘</div>’,
‘before_title’ => ‘<h3>’,
‘after_title’ => ‘</h3>’
));
register_sidebar(array(
‘id’ => ‘sidebar’,
‘name’=>’sidebar’,
‘description’ => ‘these widget areas are in the sidebar’,
‘before_widget’ => ‘<div class=”sidebar-widget”>’,
‘after_widget’ => ‘</div>’,
‘before_title’ => ‘<h3>’,
‘after_title’ => ‘</h3>’
));
}
//remove inline style – gallery
add_filter( ‘use_default_gallery_style’, ‘__return_false’ );
function remove_gallery_css( $css ) {
return preg_replace( “##s”, ”, $css );
}
if (version_compare( $GLOBALS[‘wp_version’], ‘3.1’, ‘<‘ )){
add_filter( ‘gallery_style’, ‘remove_gallery_css’ );
}
//start theme options:
$themename = “Resolution”;
$shortname = “res”;
$options = array (
array( “type” => “open”),
array( “name” => “Logo Url”,
“desc” => “Enter the full url of your logo. use a square image – 187 pixels width and 187 pixels height”,
“id” => $shortname. “_logo”,
“type” => “text”
),
array( “name” => “Header Background Image Url”,
“desc” => “Enter the full url of the image you want to use. For best results – use an image that is 980 pixels wide and 314 pixels tall (nothing less)”,
“id” => $shortname.”_bgUrl”,
“type” => “text”,
“std” => “”),
array( “name” => “Slogan”,
“desc” => “Enter the slogan that you want to have right under the logo. *This only appears in the homepage (max is 24 characters)”,
“id” => $shortname.”_slogan”,
“type” => “text”,
“std” => “”),
array( “name” => “Footer Text”,
“desc” => “Enter the text you want to have right under the logo in the footer.”,
“id” => $shortname.”_footerText”,
“type” => “textarea”,
“std” => “”),
array( “type” => “close”)
);//presentation//
function mytheme_add_admin() {
global $themename, $shortname, $options;
if ( $_GET[‘page’] == basename(__FILE__) ) {
if ( ‘save’ == $_REQUEST[‘action’] ) {
foreach ($options as $value) {
update_option( $value[‘id’], $_REQUEST[ $value[‘id’] ] ); }foreach ($options as $value) {
if( isset( $_REQUEST[ $value[‘id’] ] ) ) { update_option( $value[‘id’], $_REQUEST[ $value[‘id’] ] ); } else { delete_option( $value[‘id’] ); } }header(“Location: themes.php?page=functions.php&saved=true”);
die;} else if( ‘reset’ == $_REQUEST[‘action’] ) {
foreach ($options as $value) {
delete_option( $value[‘id’] ); }header(“Location: themes.php?page=functions.php&reset=true”);
die;}
}add_theme_page($themename.” Options”, “”.$themename.” Options”, ‘edit_themes’, basename(__FILE__), ‘mytheme_admin’);
}
function mytheme_admin() {
global $themename, $shortname, $options;
if ( $_REQUEST[‘saved’] ) echo ‘<div id=”message” class=”updated fade”><p>‘.$themename.’ settings saved.</p></div>’;
if ( $_REQUEST[‘reset’] ) echo ‘<div id=”message” class=”updated fade”><p>‘.$themename.’ settings reset.</p></div>’;?>
<div class=”wrap”>
<h2><?php echo $themename; ?> Settings</h2><form method=”post”>
<?php foreach ($options as $value) {
switch ( $value[‘type’] ) {case “open”:
?><?php break;
case “close”:
?></table>
<?php break;
case “title”:
?><td valign=”top” colspan=”2″><h3 style=”font-family:Georgia,’Times New Roman’,Times,serif;”><?php echo $value[‘name’]; ?></h3></td>
</tr><!–custom–>
<?php break;
case “sub-title”:
?>
<h3 style=”font-family:Georgia,’Times New Roman’,Times,serif; padding-left:8px;”><?php echo $value[‘name’]; ?></h3>
<!–end-of-custom–><?php break;
case ‘text’:
?><tr>
<td valign=”top” width=”20%” rowspan=”2″ valign=”middle”><?php echo $value[‘name’]; ?></td>
<td width=”80%”><input style=”width:400px;” name=”<?php echo $value[‘id’]; ?>” id=”<?php echo $value[‘id’]; ?>” type=”<?php echo $value[‘type’]; ?>” value=”<?php if ( get_settings( $value[‘id’] ) != “”) { echo get_settings( $value[‘id’] ); } else { echo $value[‘std’]; } ?>” /></td>
</tr><tr>
<td><small><?php echo $value[‘desc’]; ?></small></td><td colspan=”2″ style=”margin-bottom:5px;border-bottom:1px dotted #000000;”> <?php
break;case ‘textarea’:
?><tr>
<td valign=”top” width=”20%” rowspan=”2″ valign=”middle”><?php echo $value[‘name’]; ?></td>
<td width=”80%”><textarea name=”<?php echo $value[‘id’]; ?>” style=”width:400px; height:200px;” type=”<?php echo $value[‘type’]; ?>” cols=”” rows=””><?php if ( get_settings( $value[‘id’] ) != “”) { echo stripslashes(get_settings( $value[‘id’] )); } else { echo $value[‘std’]; } ?></textarea></td></tr>
<tr>
<td><small><?php echo $value[‘desc’]; ?></small></td><td colspan=”2″ style=”margin-bottom:5px;border-bottom:1px dotted #000000;”> <?php
break;case ‘select’:
?>
<tr>
<td width=”20%” rowspan=”2″ valign=”middle”><?php echo $value[‘name’]; ?></td>
<td width=”80%”><select style=”width:240px;” name=”<?php echo $value[‘id’]; ?>” id=”<?php echo $value[‘id’]; ?>”><?php foreach ($value[‘options’] as $option) { ?><option<?php if ( get_settings( $value[‘id’] ) == $option) { echo ‘ selected=”selected”‘; } elseif ($option == $value[‘std’]) { echo ‘ selected=”selected”‘; } ?>><?php echo $option; ?></option><?php } ?></select></td>
</tr><tr>
<td><small><?php echo $value[‘desc’]; ?></small></td><td colspan=”2″ style=”margin-bottom:5px;border-bottom:1px dotted #000000;”> <?php
break;case “checkbox”:
?>
<tr>
<td width=”20%” rowspan=”2″ valign=”middle”><?php echo $value[‘name’]; ?></td>
<td width=”80%”><?php if(get_option($value[‘id’])){ $checked = “checked=”checked””; }else{ $checked = “”;} ?>
<input type=”checkbox” name=”<?php echo $value[‘id’]; ?>” id=”<?php echo $value[‘id’]; ?>” value=”true” <?php echo $checked; ?> />
</td>
</tr><tr>
<td><small><?php echo $value[‘desc’]; ?></small></td><td colspan=”2″ style=”margin-bottom:5px;border-bottom:1px dotted #000000;”> <?php break;
}
}
?><p class=”submit”>
<input name=”save” type=”submit” value=”Save changes” />
<input type=”hidden” name=”action” value=”save” />
</p>
</form>
<form method=”post”>
<p class=”submit”>
<input name=”reset” type=”submit” value=”Reset” />
<input type=”hidden” name=”action” value=”reset” />
</p>
</form><?php
}
add_action(‘admin_menu’, ‘mytheme_add_admin’);?>
-
You did not specify a blog address or reason for posting when you created this topic.
This support forum is for blogs hosted at WordPress.com. If your question is about a self-hosted WordPress blog then you’ll find help at the WordPress.org forums.
If you don’t understand the difference between WordPress.com and WordPress.org, you may find this information helpful.
If you forgot to include a link to your blog, you can reply and include it below. It’ll help people to answer your question.
This is an automated message.
- The topic ‘Adding date and author in Fearless Flyer's "Resolution" theme’ is closed to new replies.