Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Customize AF + pro theme's category/search look WordPress

  • SOLVED

I'm trying to get the category and search results page(s) to look like the normal old blog page does for my AF themed site.

Here you can see my blog page (the look I want): http://benjacobsenphoto.com/recent-shoots/
here you can see what I've gotten it to: http://benjacobsenphoto.com/category/scapes/

I'd really love if it looked like the 7 post layout of the blog layout I've made. My template has already been modified quite a bit from the stock version though to make it 1000px wide.

Answers (1)

2010-10-04

Duncan O'Neill answers:

You may have already tried this, but if not, try this quick and dirty fix:

1) Navigate to your /wp-content/themes/autofocus/ directory
2) Back up your category.php file by saving it as category_old.php, for example
3) Find the file used for the blog page ( probably page.php, home.php, or index.php, depending on your settings ), and save it as category.php

Let me know if this works.

cheers,

Duncan


Ben Jacobsen comments:

doesn't work, thanks though.

I think this will require a bunch of new style info in the .css?


Duncan O'Neill comments:

one more thing should do it;

In your functions.php, you need to add one line to this block of code;


// Category name classes for BODY on category archvies
else if ( is_category() ) {
$cat = $wp_query->get_queried_object();
$c[] = 'category';
$c[] = 'category-' . $cat->slug;
}


so that it becomes this;


// Category name classes for BODY on category archvies
else if ( is_category() ) {
$cat = $wp_query->get_queried_object();
$c[] = 'category';
$c[] = 'category-' . $cat->slug;
$c[] = 'home'; // additional line

}


Ben Jacobsen comments:

I can't find that in my functions.php?

<?php

// Set Up AutoFocus+ Pro
// - Tell WordPress to run af_setup() when the 'after_setup_theme' hook is run.
add_action( 'after_setup_theme', 'af_setup' );

if ( ! function_exists( 'af_setup' ) ):
function af_setup() {
// This theme styles the visual editor with editor-style.css to match the theme style.
add_editor_style();

// This theme uses post thumbnails
add_theme_support( 'post-thumbnails' );

// Add AutoFocus+ Pro Header
define( 'HEADER_TEXTCOLOR', '' );
// No CSS, just IMG call. The %s is a placeholder for the theme template directory URI.
define( 'HEADER_IMAGE', '%s/css/headers/path.jpg' );

// The height and width of your custom header. You can hook into the theme's own filters to change these values.
// Add a filter to twentyten_header_image_width and twentyten_header_image_height to change these values.
define( 'HEADER_IMAGE_WIDTH', apply_filters( 'af_header_image_width', 292 ) );
define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'af_header_image_height', 50 ) );

// We'll be using post thumbnails for custom header images on posts and pages.
// We want them to be 50 pixels wide by 50 pixels tall.
// Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php.
set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true );

// Add AutoFocus+ Pro Header styles for Admin
add_custom_image_header( '', 'af_admin_header_style' );

// Default custom headers packaged with the theme. %s is a placeholder for the theme template directory URI.
register_default_headers( array(
'autofocus' => array(
'url' => get_bloginfo('stylesheet_directory') . '/img/logo.png',
'thumbnail_url' => get_bloginfo('stylesheet_directory') . '/img/logo.png',
'description' => __( 'AutoFocus Logo', 'thematic' )
)
) );
}
endif;

// Add AutoFocus+ Pro Header styles for Admin
if ( ! function_exists( 'af_admin_header_style' ) ) :
function af_admin_header_style() {
global $options;
foreach ($options as $value) {
if (get_settings( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; } else { $$value['id'] = get_settings( $value['id'] ); }
} ?>
<style type="text/css">
/* Shows the same border as on front end */
.appearance_page_custom-header #headimg {min-height:50px;border-width:0;padding:0;margin:0;background:#FFF;background-repeat:no-repeat;background-position:0 center;width:292px;margin:0 16px 0 0;float:left;clear:none;display:block;}
#headimg:hover {background-color:#<?php echo $af_hover_color; ?>;}
#headimg h1 {line-height:50px;position:relative;padding:0 0 0 50px;margin:0;}
#headimg #name {color:#<?php echo $af_hover_color; ?>;padding:0 8px;font-size:22px;font-weight:200;text-decoration:none;line-height:50px;font-family: "Garamond", "Hoefler Text", Times New Roman, Times, serif;}
#headimg:hover #name {color:#FFF;}
#headimg #desc {display:none;}
</style>
<?php }
endif;

// Set default content width for images in post content
$_GLOBALS['content_width'] = 494;

// Conditional test for IE6
function browser_ie6() {
$agents = array(
'MSIE 6.0'
);
foreach ($agents as $agent) {
if (strpos($_SERVER['HTTP_USER_AGENT'], $agent) or isset($_GET[$agent]) && $_GET[$agent] ) {
return true;
}
}
return false;
}

// Pull Quote Shortcode
function pull_quote_sc($atts, $content = null) {
extract( shortcode_atts( array(
'author' => 'Author’s Name (Default)',
), $atts ) );
return '<blockquote class="pull-quote"><p>' . $content . '</p><cite class="author"> &mdash; ' . esc_attr($author) . '</cite></blockquote>';
}
add_shortcode("pullquote", "pull_quote_sc");

// Large Post Image Shortcode
function large_image_sc($atts, $content = null) {
extract( shortcode_atts( array(
// 'description' => 'This is a short or detailed description for the image you see over there on the left. (Default)',
'description' => '',
), $atts ) );
if (!browser_ie6() && !$description == '') {
return '<div class="large-image">' . $content . '<p class="description">' . esc_attr($description) . '</p></div>';
} elseif ( !$description == '' ) {
return '<p class="large-image">' . $content . '</p><p class="description ie6">' . esc_attr($description) . '</p>';
} elseif ( $description == '' ) {
return '<p class="large-image">' . $content . '</p>';
}
}
add_shortcode("largeimage", "large_image_sc");

// Narrow Columns Shortcode
function narrow_column_sc($atts, $content = null) {
extract( shortcode_atts( array(
'side' => 'left',
), $atts ) );
return '<div class="narrow-column ' . esc_attr($side) . '"><p>' . $content . '</p></div>';
}
add_shortcode("narrowcolumn", "narrow_column_sc");

// Thanks very much to Thin & Light (http://thinlight.org/) for this custom function!
function tl_excerpt($text, $excerpt_length = 25) {
$text = str_replace(']]>', ']]&gt;', $text);
$text = strip_tags($text);
$text = preg_replace("/\[.*?]/", "", $text);
$words = explode(' ', $text, $excerpt_length + 1);
if (count($words) > $excerpt_length) {
array_pop($words);
array_push($words, '...');
$text = implode(' ', $words);
}
return apply_filters('the_excerpt', $text);
}

function tl_post_excerpt($post) {
$excerpt = ($post->post_excerpt == '') ? (tl_excerpt($post->post_content))
: (apply_filters('the_excerpt', $post->post_excerpt));
return $excerpt;
}

function previous_post_excerpt($in_same_cat = 1, $excluded_categories = '') {
if ( is_attachment() )
$post = &get_post($GLOBALS['post']->post_parent);
else
$post = get_previous_post($in_same_cat, $excluded_categories);

if ( !$post )
return;
$post = &get_post($post->ID);
echo tl_post_excerpt($post);
}

function next_post_excerpt($in_same_cat = 1, $excluded_categories = '') {
if ( is_attachment() )
$post = &get_post($GLOBALS['post']->post_parent);
else
$post = get_next_post($in_same_cat, $excluded_categories);

if ( !$post )
return;
$post = &get_post($post->ID);
echo tl_post_excerpt($post);
}

// Photo Author/Credit Display
function autofocus_credit() {
global $post;

if ( get_the_author_meta('user_url') == '' ) { ?>
<span class="photo-credit">&copy; <?php the_time('Y'); ?> <?php the_author_meta('display_name'); ?>. <?php _e('All rights reserved.', 'thematic'); ?></span>
<?php } else { ?>
<span class="photo-credit">&copy; <?php the_time('Y'); ?> <a href="<?php the_author_meta('user_url'); ?>" target="_blank" rel="author"><?php the_author_meta('display_name'); ?></a>. <?php _e('All rights reserved.', 'thematic'); ?></span>
<?php } ?>

<?php }

// Post Attachment image function. Direct link to file.
function the_post_image($size=large, $fullsize=false, $width=1000, $height=667, $max_dims=false) {

global $post;
$linkedimgtag = get_post_meta ($post->ID, 'image_tag', true);

if ( $images = get_children(array(
'post_parent' => get_the_ID(),
'post_type' => 'attachment',
'numberposts' => 1,
'post_mime_type' => 'image',)))
{
foreach( $images as $image ) {
$attachmenturl=wp_get_attachment_url($image->ID);
$attachmentimage=wp_get_attachment_image( $image->ID, $size );
$attachmentresize=get_attachment_innerHTML($image->ID, $fullsize, array($width, $height));

echo $attachmentimage;
}

} elseif ( $linkedimgtag ) {

echo $linkedimgtag;

} elseif ( $linkedimgtag && $images = get_children(array(
'post_parent' => get_the_ID(),
'post_type' => 'attachment',
'numberposts' => 1,
'post_mime_type' => 'image',)))
{
foreach( $images as $image ) {
$attachmenturl=wp_get_attachment_url($image->ID);
$attachmentimage=wp_get_attachment_image( $image->ID, $size );
$attachmentresize=get_attachment_innerHTML($image->ID, $size, array($width, $height));

echo $attachmentresize;
}

} elseif (get_post_meta($post->ID, 'image_tag', $single = true) == "" && is_single()) {
// Don’t show anything on Single pages that don’t have Image or Video attachments.

} else {
echo '<!-- No Image Attached! -->';
echo '<img src="';
echo get_bloginfo ( 'stylesheet_directory' ) . '/img/no-attachment.png';
echo '" width="655" height="200" />';
}
}

// Setup Images for Attachment functions
function image_setup($postid) {
global $post;
$post = get_post($postid);

// get url
if ( !preg_match('/<img ([^>]*)src=(\"|\')(.+?)(\2)([^>\/]*)\/*>/', $post->post_content, $matches) ) {
return false;
}

// url setup /**/
$post->image_url = $matches[3];
if ( !$post->image_url = preg_replace('/\?w\=[0-9]+/','', $post->image_url) )
return false;

$post->image_url = clean_url( $post->image_url, 'raw' );

delete_post_meta($post->ID, 'image_url');
delete_post_meta($post->ID, 'image_tag');

add_post_meta($post->ID, 'image_url', $post->image_url);
add_post_meta($post->ID, 'image_tag', '<img src="'.$post->image_url.'" />');
}
add_action('publish_post', image_setup);
add_action('publish_page', image_setup);

// Post Attachment image function for Attachment Pages.
function the_attachment_image($size=large) {
$attachmenturl=wp_get_attachment_url($image->ID);
$attachmentimage=wp_get_attachment_image( $image->ID, $size );

echo ''.$attachmentimage.'';
}

// Grab EXIF Data from Attachments
// http://www.bloggingtips.com/2008/07/20/wordpress-gallery-and-exif/
function grab_exif_data() {
$imgmeta = wp_get_attachment_metadata($id);

// Start to display EXIF and IPTC data of digital photograph
echo "<h3 id='exif-data'>Exif Data</h3>";
echo "<ul><li><span class=\"exif-title\">Date Taken:</span> " . date("d-M-Y H:i:s", $imgmeta['image_meta']['created_timestamp'])."</li>";
echo "<li><span class=\"exif-title\">Copyright:</span> " . $imgmeta['image_meta']['copyright']."</li>";
echo "<li><span class=\"exif-title\">Credit:</span> " . $imgmeta['image_meta']['credit']."</li>";
echo "<li><span class=\"exif-title\">Title:</span> " . $imgmeta['image_meta']['title']."</li>";
echo "<li><span class=\"exif-title\">Caption:</span> " . $imgmeta['image_meta']['caption']."</li>";
echo "<li><span class=\"exif-title\">Camera:</span> " . $imgmeta['image_meta']['camera']."</li>";
echo "<li><span class=\"exif-title\">Focal Length:</span> " . $imgmeta['image_meta']['focal_length']."mm</li>";
echo "<li><span class=\"exif-title\">Aperture:</span> f/" . $imgmeta['image_meta']['aperture']."</li>";
echo "<li><span class=\"exif-title\">ISO:</span> " . $imgmeta['image_meta']['iso']."</li>";
echo "<li><span class=\"exif-title\">Shutter Speed:</span> 1/" . (1/$imgmeta['image_meta']['shutter_speed']) ." seconds</li>\n</ul>";
}

// Get the Post Thumbnail URL for the EXIF link
function exif_link( $post_id = NULL, $size = 'single-post-thumbnail', $attr = '' ) {
global $id;
$post_id = ( NULL === $post_id ) ? $id : $post_id;
$post_thumbnail_id = get_post_thumbnail_id( $post_id );
$size = apply_filters( 'single-post-thumbnail', $size );
if ( $post_thumbnail_id ) {
$thumburl = get_attachment_link( $post_thumbnail_id, $size, false, $attr );
} else {
$thumburl = '';
}
return $thumburl;
}

// Add Images/Video/Embeds to feeds
// - Based on the Custom Fields for Feeds Plugin by Justin Tadlock
// - http://justintadlock.com/archives/2008/01/27/custom-fields-for-feeds-wordpress-plugin
function autofocus_feed( $content ) {
global $post, $id, $afoptions;
foreach ($afoptions as $value) {
if (get_settings( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; } else { $$value['id'] = get_settings( $value['id'] ); }
}

$blog_key = substr( md5( get_bloginfo('url') ), 0, 16 );

if ( !is_feed() ) return $content;

// Is there a Video attached?
// - WordPress doesn’t setup [embed] codes as shortcodes.
// - Embedded content will not work in feeds without it.
// - See: http://core.trac.wordpress.org/ticket/12505

// if ( get_post_meta($post->ID, 'videoembed_value', true) ) {
// $af_video_url = get_post_meta($post->ID, 'videoembed_value', true);
// $mediafeed = '[embed width="600" height="400"]' . $af_video_url . '[/embed]';
// }

// If there’s no video is there an image thumbnail?
if ( has_post_thumbnail() ) {
$mediafeed = the_post_thumbnail('medium');
}

// If there's a video or an image, display the media with the content
if ($mediafeed !== '') {
$content = '<p>' .$mediafeed . '</p><br />' . $content;
return $content;

// If there's no media, just display the content
} else {
$content = $content;
return $content;
}
}
add_filter('the_content', 'autofocus_feed');

// Add Post Thumbnails Support
// - http://markjaquith.wordpress.com/2009/12/23/new-in-wordpress-2-9-post-thumbnail-images/
if ( function_exists( 'add_theme_support' ) ) { // Added in 2.9
set_post_thumbnail_size( 88, 88, true ); // Default thumbnail size
add_image_size( 'archive-thumbnail', 655, 200, true ); // Archives thumbnail size
add_image_size( 'single-post-thumbnail', 1000, 667 ); // Single Posts thumbnail size
add_image_size( 'front-page-thumbnail', 1000, 300, true ); // Front Page thumbnail size
}

// Custom AutoFocus Thumbnail Sizes
// - http://www.waltervos.com/wordpress-plugins/additional-image-sizes/
function af_image_sizes( $sizes ) {
$sizes[] = 'afthumb';
$sizes[] = 'aflarge';
$sizes[] = 'afsingle';
return $sizes;
}
add_filter( 'intermediate_image_sizes', 'af_image_sizes' );

// Custom image size settings initiated at activation
if ( is_admin() && isset($_GET['activated'] ) && $pagenow == 'themes.php' ) {
if( FALSE === get_option('af_size_w') ) {
add_option('afthumb_size_w', '655');
add_option('afthumb_size_h', '200');
add_option('afthumb_crop', '1');

add_option('aflarge_size_w', '1000');
add_option('aflarge_size_h', '300');
add_option('aflarge_crop', '1');

add_option('afsingle_size_w', '1000');
add_option('afsingle_size_h', '667');
add_option('afsingle_crop', '0');
} else {
update_option('afthumb_size_w', '655');
update_option('afthumb_size_h', '200');
update_option('afthumb_crop', '1');

update_option('aflarge_size_w', '1000');
update_option('aflarge_size_h', '300');
update_option('aflarge_crop', '1');

update_option('afsingle_size_w', '1000');
update_option('afsingle_size_h', '667');
update_option('afsingle_crop', '0');
}

update_option('thumbnail_size_h', '88');
update_option('thumbnail_size_w', '88');
update_option('thumbnail_crop', '1');

update_option('medium_size_h', '655');
update_option('medium_size_w', '200');
update_option('medium_crop', '0');

update_option('large_size_h', '494');
update_option('large_size_w', '494');
update_option('large_crop', '0');

update_option('thread_comments', '1');
update_option('thread_comments_depth', '2');

update_option( 'posts_per_page', '12');
update_option( 'date_format', __('j M ’y') );
}

// Add oEmbed support for SoundCloud
if ( function_exists('wp_oembed_add_provider') ) {
wp_oembed_add_provider( '#http://(www\.)?soundcloud.com/.*#i', 'http://www.soundcloud.com/oembed/', true );
}

// Post Options and Instructions
// - Create Instructions for Shortcodes
function instructions_box() { ?>
<div class="form-wrap">

<dl style="padding:8px;margin-bottom:10px;">
<dt style="margin-bottom:0;font-size:1.3em;"><?php _e('Example', 'thematic') ?></dt>
<dd>
<p><?php _e('Usage: ', 'thematic') ?><code>[pullquote author="John Doe"]<?php _e('This is the quoted text.', 'thematic') ?>[/pullquote]
</p>
</dd>
</dl>

<dl style="padding:8px;margin-bottom:10px;">
<dt style="margin-bottom:0;font-size:1.3em;">[pullquote]</dt>
<dd style="margin-bottom:30px;">
<p><?php _e('Adds a pull quote about the project.', 'thematic') ?></p>
<p><?php _e('Usage: ', 'thematic') ?>[pullquote foo="bar"]%quoted text%[/pullquote]</p>
<ul style="font-size:1em;list-style:disc;list-style-position:inside;margin-left:20px;">
<p><?php _e('Parameters:', 'thematic') ?></p>
<li>author="The Author’s Name"</li>
</ul>
</dd>

<dt style="margin-bottom:0;font-size:1.3em;">[largeimage]</dt>
<dd style="margin-bottom:30px;">
<p><?php _e('Adds a larger post image with a hovering description. Requires an image at least 1000px wide.', 'thematic') ?></p>
<p><?php _e('Usage: ', 'thematic') ?>[largeimage foo="bar"]%large size image%[/largeimage]</p>
<ul style="font-size:1em;list-style:disc;list-style-position:inside;margin-left:20px;">
<p><?php _e('Parameters:', 'thematic') ?></p>
<li>description="This is your description."</li>
</ul>
</dd>

<dt style="margin-bottom:0;font-size:1.3em;">[narrowcolumn]</dt>
<dd style="margin-bottom:0px;">
<p><?php _e('Adds a narrow paragraph area. Use 2 narrow columns together with left and right parameters to create a 2 column area.', 'thematic') ?></p>
<p><?php _e('Usage: ', 'thematic') ?>[narrowcolumn foo="bar"]%content%[/narrowcolumn]</p>
<ul style="font-size:1em;list-style:disc;list-style-position:inside;margin-left:20px;">
<p><?php _e('Parameters:', 'thematic') ?></p>
<li>side="left"</li>
<li>side="right"</li>
</ul>
</dd>
</dl>

</div>
<?php }

// - New Array For Video Embed Codes, Copyright info, and Gallery Display Option
$af_meta_boxes = array(
"video" => array(
"name" => "videoembed_value",
"title" => __("Embed URL","thematic"),
"type" => "text",
"std" => "",
"description" => __("Paste your oEmbed URL here. (Examples: http://vimeo.com/7757262, http://www.flickr.com/photos/bking/3598750242/)","thematic")),
"copyright" => array(
"name" => "copyright_value",
"title" => __("Photo Credit","thematic"),
"type" => "text",
"std" => "",
"description" => __("Text entered here will replace the default Photo credit. (Example: &copy; 2009 Image Author. All rights reserved.)","thematic")),
"showgallery" => array(
"name" => "show_gallery",
"title" => __("Show Image Gallery?","thematic"),
"type" => "checkbox",
"std" => "false",
"description" => __("Show a sliding Gallery of attached images above the post title? (Limited to 10 images. IMPORTANT: All images must be at least 1000px wide or 667px tall.)","thematic")),
);

// - New Meta Boxes For Video Embed Codes
function new_meta_boxes() {
global $post, $af_meta_boxes; ?>

<div class="form-wrap">

<?php
foreach($af_meta_boxes as $meta_box) {
$meta_box_value = get_post_meta($post->ID, $meta_box['name'], true);

if($meta_box_value == "")
$meta_box_value = $meta_box['std'];

echo'<input type="hidden" name="'.$meta_box['name'].'_noncename" id="'.$meta_box['name'].'_noncename" value="'.wp_create_nonce( plugin_basename(__FILE__) ).'" />';

switch ( $meta_box['type'] ) {
case 'text':
echo '<div class="form-field form-required">';
echo '<label for="'.$meta_box['name'].'">'.$meta_box['title'].'</label>';
echo '<input type="text" name="'.$meta_box['name'].'" value="'.$meta_box_value.'" />';
echo '<p id="'.$meta_box['name'].'">'.$meta_box['description'].'</p></div>';
break;

case 'checkbox':
echo '<div class="form-field form-required">';
echo '<label for="'.$meta_box['name'].'" class="selectit">'.$meta_box['title'];
echo '<input type="checkbox" style="text-align:left;width:50px;" name="'.$meta_box['name'].'" value="true"';
checked('true', $meta_box_value);
echo ' /></label>';
echo '<p id="'.$meta_box['name'].'">'.$meta_box['description'].'</p></div>';
break;
}
} ?>
</div>
<?php }

// - Create Form Data
function create_meta_box() {
global $theme_name;
if ( function_exists('add_meta_box') ) {
add_meta_box( 'new-meta-boxes', 'AutoFocus+ Pro Post Options', 'new_meta_boxes', 'post', 'normal', 'high' );
add_meta_box( 'new-instructions-boxes', 'AutoFocus+ Pro Instructions', 'instructions_box', 'post', 'normal', 'high' );
}
}

// - Save Form Data
function save_postdata( $post_id ) {
global $post, $af_meta_boxes;

foreach($af_meta_boxes as $meta_box) {
// Verify
if ( !wp_verify_nonce( $_POST[$meta_box['name'].'_noncename'], plugin_basename(__FILE__) )) {
return $post_id;
}

if ( 'page' == $_POST['post_type'] ) {
if ( !current_user_can( 'edit_page', $post_id ))
return $post_id;
} else {
if ( !current_user_can( 'edit_post', $post_id ))
return $post_id;
}

$data = $_POST[$meta_box['name']];

if(get_post_meta($post_id, $meta_box['name']) == "")
add_post_meta($post_id, $meta_box['name'], $data, true);

elseif($data != get_post_meta($post_id, $meta_box['name'], true))
update_post_meta($post_id, $meta_box['name'], $data);

elseif($data == "")
delete_post_meta($post_id, $meta_box['name'], get_post_meta($post_id, $meta_box['name'], true));
}
}
add_action( 'admin_menu', 'create_meta_box' );
add_action( 'save_post', 'save_postdata' );

// Theme Options --------------------------------------------
$afthemename = "AutoFocus+ Pro";
$afshortname = "af";
$afoptions = array();

function autofocus_options() {
global $afthemename, $afshortname, $afoptions;
$af_categories_obj = get_categories('hide_empty=0');
$af_categories = array();
foreach ($af_categories_obj as $af_cat) {
$af_categories[$af_cat->cat_ID] = $af_cat->cat_name;
}
$categories_std = array_unshift($af_categories, "Select a category:");

$afoptions = array (

// Replaced with WP 3.0 Custom Image Header: http://codex.wordpress.org/Function_Reference/add_custom_image_header
// array( "name" => __('Show a logo','thematic'),
// "desc" => __('Show a small logo next to the Blog Title? Replace the logo.png file found in the /img/ folder with your own custom logo. (Recommended logo size: 50px &times; 50px).','thematic'),
// "id" => $afshortname."_show_logo",
// "std" => "false",
// "type" => "checkbox"),

// array( "name" => __('Hide blog title?','thematic'),
// "desc" => __('Hide the blog title and description?','thematic'),
// "id" => $afshortname."_hide_title",
// "std" => "false",
// "type" => "checkbox"),

array( "name" => __('Portfolio Layout','thematic'),
"desc" => __('Switch to the Portfolio layout on the home page?','thematic'),
"id" => $afshortname."_portfolio_layout",
"std" => "false",
"type" => "checkbox"),

array( "name" => __('Sliding Feature Area','thematic'),
"desc" => __('Show a sliding featured content area?','thematic'),
"id" => $afshortname."_sliding_sticky_area",
"std" => "false",
"type" => "checkbox"),

array( "name" => __('Blog Category','thematic'),
"desc" => __('Select a post category to be shown in the Blog Template and excluded from the Front Page.','thematic'),
"id" => $afshortname."_blog_cat",
"std" => $categories_std,
"type" => "select",
"options" => $af_categories),

array( "name" => __('Text Color'),
"desc" => __('Change the color of links, backgrounds and borders by entering a HEX color number. (ie: <span style="font-family:Monaco,Lucida Console,Courier,monospace;">003333</span>)','thematic'),
"id" => $afshortname."_text_color",
"std" => "999999",
"type" => "colorpicker"),

array( "name" => __('Link Color','thematic'),
"desc" => __('Change the color of hover links by entering a HEX color number. (ie: <span style="font-family:Monaco,Lucida Console,Courier,monospace;">FF6600</span>)','thematic'),
"id" => $afshortname."_link_color",
"std" => "00CCFF",
"type" => "colorpicker"),

array( "name" => __('Background Color','thematic'),
"desc" => __('Change the color of hover links by entering a HEX color number. (ie: <span style="font-family:Monaco,Lucida Console,Courier,monospace;">FF6600</span>)','thematic'),
"id" => $afshortname."_bg_color",
"std" => "FFFFFF",
"type" => "colorpicker"),

array( "name" => __('Photo Background Color','thematic'),
"desc" => __('Change the background color of Portrait (narrow) images by entering a HEX color number. (ie: <span style="font-family:Monaco,Lucida Console,Courier,monospace;">FF6600</span>. Note: If left empty, the background color will be transparent.','thematic'),
"id" => $afshortname."_photo_color",
"std" => "F0F0F0",
"type" => "colorpicker"),

array( "name" => __('Show Post Titles','thematic'),
"desc" => __('Add a check here to show Post Titles instead of Post Dates on the home page.','thematic'),
"id" => $afshortname."_show_post_title",
"std" => "false",
"type" => "checkbox"),

array( "name" => __('Show Post Dates','thematic'),
"desc" => __('Add a check here to show the Posts Dates.','thematic'),
"id" => $afshortname."_show_dates",
"std" => "false",
"type" => "checkbox"),

array( "name" => __('Show Exif data','thematic'),
"desc" => __('Add a check here to show the Exif data for your images on attachment pages (WP Gallery Images only).','thematic'),
"id" => $afshortname."_show_exif_data",
"std" => "false",
"type" => "checkbox")

);
}
add_action('init', 'autofocus_options');

// Make a Theme Options Page
function af_add_admin() {

global $afthemename, $afshortname, $afoptions;

if ( $_GET['page'] == basename(__FILE__) ) {

if ( 'save' == $_REQUEST['action'] ) {

foreach ($afoptions as $afvalue) {
update_option( $afvalue['id'], $_REQUEST[ $afvalue['id'] ] ); }

foreach ($afoptions as $afvalue) {
if( isset( $_REQUEST[ $afvalue['id'] ] ) ) { update_option( $afvalue['id'], $_REQUEST[ $afvalue['id'] ] ); } else { delete_option( $afvalue['id'] ); } }

header("Location: themes.php?page=functions.php&saved=true");
die;

} else if( 'reset' == $_REQUEST['action'] ) {

foreach ($afoptions as $afvalue) {
delete_option( $afvalue['id'] ); }

header("Location: themes.php?page=functions.php&reset=true");
die;

}
}

add_theme_page($afthemename." Options", "$afthemename Options", 'edit_themes', basename(__FILE__), 'af_admin');

}

function af_admin() {

global $afthemename, $afshortname, $afoptions;

if ( $_REQUEST['saved'] ) echo '<div id="message" class="updated fade"><p><strong>'.$afthemename.' settings saved.</strong></p></div>';
if ( $_REQUEST['reset'] ) echo '<div id="message" class="updated fade"><p><strong>'.$afthemename.' settings reset.</strong></p></div>';

?>
<script language="javascript" type="text/javascript" src="<?php echo bloginfo('stylesheet_directory') ?>/js/jscolor/jscolor.js"></script>
<div class="wrap">
<h2><?php echo $afthemename; ?> Options</h2>

<form method="post">

<table class="form-table">

<?php foreach ($afoptions as $afvalue) {

switch ( $afvalue['type'] ) {
case 'text':
?>
<tr valign="top">
<th scope="row"><?php echo $afvalue['name']; ?>:</th>
<td>
<input name="<?php echo $afvalue['id']; ?>" id="<?php echo $afvalue['id']; ?>" type="<?php echo $afvalue['type']; ?>" value="<?php if ( get_settings( $afvalue['id'] ) != "") { echo get_settings( $afvalue['id'] ); } else { echo $afvalue['std']; } ?>" />
<?php echo $afvalue['desc']; ?>
</td>
</tr>
<?php
break;

case 'colorpicker':
?>
<tr valign="top">
<th scope="row"><label for="<?php echo $afvalue['id']; ?>"><?php echo __($afvalue['name'],'thematic'); ?></label></th>
<td>
<input type="<?php echo $afvalue['type']; ?>" name="<?php echo $afvalue['id']; ?>" id="<?php echo $afvalue['id']; ?>" value="<?php if ( get_option( $afvalue['id'] ) != "") { echo get_option( $afvalue['id'] ); } else { echo $afvalue['std']; } ?>" class="color {pickerPosition:'right'}" />
<?php echo __($afvalue['desc'],'thematic'); ?>

</td>
</tr>
<?php
break;

case 'select':
?>
<tr valign="top">
<th scope="row"><?php echo $afvalue['name']; ?></th>
<td>
<select name="<?php echo $afvalue['id']; ?>" id="<?php echo $afvalue['id']; ?>">
<?php foreach ($afvalue['options'] as $option) { ?>
<option<?php if ( get_settings( $afvalue['id'] ) == $option) { echo ' selected="selected"'; } elseif ($option == $afvalue['std']) { echo ' selected="selected"'; } ?>><?php echo $option; ?></option>
<?php } ?>
</select>
<?php echo $afvalue['desc']; ?>
</td>
</tr>
<?php
break;

case 'textarea':
$ta_options = $afvalue['options'];
?>
<tr valign="top">
<th scope="row"><?php echo $afvalue['name']; ?>:</th>
<td>
<?php echo $afvalue['desc']; ?>
<textarea name="<?php echo $afvalue['id']; ?>" id="<?php echo $afvalue['id']; ?>" cols="<?php echo $ta_options['cols']; ?>" rows="<?php echo $ta_options['rows']; ?>"><?php
if( get_settings($afvalue['id']) != "") {
echo stripslashes(get_settings($afvalue['id']));
}else{
echo $afvalue['std'];
}?></textarea>
</td>
</tr>
<?php
break;

case "radio":
?>
<tr valign="top">
<th scope="row"><?php echo $afvalue['name']; ?>:</th>
<td>
<?php foreach ($afvalue['options'] as $key=>$option) {
$radio_setting = get_settings($afvalue['id']);
if($radio_setting != ''){
if ($key == get_settings($afvalue['id']) ) {
$checked = "checked=\"checked\"";
} else {
$checked = "";
}
}else{
if($key == $afvalue['std']){
$checked = "checked=\"checked\"";
}else{
$checked = "";
}
}?>
<input type="radio" name="<?php echo $afvalue['id']; ?>" value="<?php echo $key; ?>" <?php echo $checked; ?> /><?php echo $option; ?><br />
<?php } ?>
</td>
</tr>
<?php
break;

case "checkbox":
?>
<tr valign="top">
<th scope="row"><?php echo $afvalue['name']; ?></th>
<td>
<?php
if(get_settings($afvalue['id'])){
$checked = "checked=\"checked\"";
}else{
$checked = "";
}
?>
<input type="checkbox" name="<?php echo $afvalue['id']; ?>" id="<?php echo $afvalue['id']; ?>" value="true" <?php echo $checked; ?> />
<?php ?>
<?php echo $afvalue['desc']; ?>
</td>
</tr>
<?php
break;

default:

break;
}
}
?>

</table>

<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>

<p><?php _e('For more information about this theme, visit the <a href="http://fthrwght.com/autofocus">documentation page</a>. If you have any questions, check out <a href="http://wpquestions.com/">WPQuestions.com</a>.', 'thematic'); ?></p>

<?php }
add_action('admin_menu' , 'af_add_admin');

// Load Color Options
function af_load_color_options() {
global $afoptions;
foreach ($afoptions as $afvalue) {
if (get_settings( $afvalue['id'] ) === FALSE) { $$afvalue['id'] = $afvalue['std']; } else { $$afvalue['id'] = get_settings( $afvalue['id'] ); }
} ?>
<style type="text/css">
/* <![CDATA[ */
/* AutoFocus+ Pro Colors */
<?php $afcoloroptions = dirname( __FILE__ ) . '/css/af-styles.php'; if( is_file( $afcoloroptions ) ) require $afcoloroptions; ?>
/* ]]> */
</style>
<?php }
add_action('wp_head', 'af_load_color_options');

// Add custom Plugins and Styles on NON-admin pages.
function af_enqueue_styles() {
global $afoptions;
foreach ($afoptions as $value) {
if (get_settings( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; } else { $$value['id'] = get_settings( $value['id'] ); }
}

if ( !is_admin() ) { // Is this necessary?

if ($af_sliding_sticky_area == 'true' && $af_portfolio_layout == 'false' ) {
wp_enqueue_style('afdefaultslider', get_bloginfo('stylesheet_directory') . '/css/default-slider-layout.css','','20100629','all');
} elseif ( $af_portfolio_layout == 'false' ) {
wp_enqueue_style('afdefault', get_bloginfo('stylesheet_directory') . '/css/default-layout.css','','20100329','all');
} elseif ( $af_portfolio_layout == 'true' ) {
wp_enqueue_style('afportfolio', get_bloginfo('stylesheet_directory') . '/css/portfolio-layout.css','','20100610','all');
}

// BOO IE6! :-/
wp_enqueue_style('afiestyles', get_bloginfo('stylesheet_directory') . '/css/ie-styles.css','','20100329','all');

}
}
add_action('init', 'af_enqueue_styles');

// Add custom JS & jQuery scripts on NON-admin pages.
function af_enqueue_scripts() {
if ( !is_admin() ) { // Is this necessary?
if( !browser_ie6() ) {
wp_enqueue_script('imgCenter', get_bloginfo('stylesheet_directory') . '/js/jquery.imgCenter.minified.js', array('jquery'), '1.0' );
wp_enqueue_script('hotkeys', get_bloginfo('stylesheet_directory') . '/js/jquery.hotkeys-0.7.9.min.js', array('jquery'), '0.7.9' );
wp_enqueue_script('easing', get_bloginfo('stylesheet_directory') . '/js/jquery.easing.1.2.js', array('jquery'), '1.2' );
wp_enqueue_script('anythingslider', get_bloginfo('stylesheet_directory') . '/js/jquery.anythingslider.js', array('jquery', 'easing'), '1.2' );
wp_enqueue_script('autofocusjs', get_bloginfo('stylesheet_directory') . '/js/afscripts.js', array('jquery', 'anythingslider', 'hotkeys', 'imgCenter'), '1.3' );
}
}
}
add_action('wp_print_scripts', 'af_enqueue_scripts');

// Load Thematic Functions
require_once(STYLESHEETPATH . '/thematic-functions.php');

?></code>


Duncan O'Neill comments:

All I was doing in the above code was adding a class attribute to the body when displaying a category.

I'll find another way to do it, and get back to you.


Ben Jacobsen comments:

yeah, it does look like that's the right path, but I've searched all the files in both themes (since it's a child) and couldn't find that bit of code anywhere... weird.

not sure how familiar you are with AF and the new pro version, but all the class definitions for the home/blog page are kept in a secondary .css file called /css/default-layout.css


Duncan O'Neill comments:

It looks like autofocus+ uses the thematic framework? Can you by any chance find that block of code in thematic-functions.php?


Ben Jacobsen comments:

yes it does and no I can't, thematic's functions is super short:
<?php

//
// Custom Child Theme Functions
//

// I've included a "commented out" sample function below that'll add a home link to your menu
// More ideas can be found on "A Guide To Customizing The Thematic Theme Framework"
// http://themeshaper.com/thematic-for-wordpress/guide-customizing-thematic-theme-framework/

// Adds a home link to your menu
// http://codex.wordpress.org/Template_Tags/wp_page_menu
//function childtheme_menu_args($args) {
// $args = array(
// 'show_home' => 'home',
// 'sort_column' => 'menu_order',
// 'menu_class' => 'menu',
// 'echo' => true
// );
// return $args;
//}
//add_filter('wp_page_menu_args','childtheme_menu_args');


?>


(BTW, any way to edit out the other functions.php so this post is shorter?! lol)

and I've even gone as far as to search the entire folder of both themes for the $cat part of the code and it's not found anywhere in either theme/folder?


Duncan O'Neill comments:

No, it's not in thematic-functions.php either....

I was using autofocus on my localhost, not autofocus+, which I'm now installing.

Also, it looks like you need to add a class of "blog" to the <body> on your category archive.


Duncan O'Neill comments:

No, I meant thematic-functions.php in the autofocus theme folder. But ignore that, it's not there either.


Ben Jacobsen comments:

how do I add the class "blog" to the category archive?


Duncan O'Neill comments:

Ben, please check your messages.


Ben Jacobsen comments:

replied.


Duncan O'Neill comments:

This solution works on my localhost, with autofocus+;

1) Find the file used for the blog page ( probably page.php, home.php, or index.php, depending on your settings ), as above, FROM /wp-content/themes/thematic/ TO /wp-content/themes/autofocuspluspro

2) Go to style.css in your autofocus folder. Copy the entire section headed /* Image Grid for the Home Page */ to a new part of that file. In the copied code, replace .blog etc with .category etc

3) Add this code to your functions.php in the autofocus+ folder. I added it at the bottom of the file just above the load thematic functions comment;


add_filter('body_class',dbo_change_cat_body_class,1);

function dbo_change_cat_body_class($c){
if (is_category()){
unset($c[array_search("archive",$c)]);
$c[]="blog";
return $c;
}
}


Duncan O'Neill comments:

Sorry, step 3 above should use this code;


add_filter('body_class',dbo_change_cat_body_class,1);

function dbo_change_cat_body_class($c){
if (is_category()){
unset($c[array_search("archive",$c)]);
$c[]="blog";
}
return $c;
}


the return needs to be outside the if block.


Ben Jacobsen comments:

Duncan, you are amazing!!!! Thanks you so much!


Ben Jacobsen comments:

OK, this actually isn't working. When I looked at it yesterday I didn't realize my first page of posts were all in the same category anyway, so I didn't notice that it wasn't filtering out the non category specific posts...

how do I modify that last bit of code so it works with categories? If I remove that code, it works, but it removes the formatting...