I am currently making a “ComicPress – Plugin” designed after the Comic Easel plugin, but uses the ComicPress coding scheme that will work in conjunction with ComicPress Manager. Which will allow you to use ComicPress on the Easel theme and integrate it into any theme on the WordPress repository.
It’s either that or I take the Easel theme and move ComicPress into it ;/ ONE OR THE OTHER! Which one would you rather have? .. seriously, need to know.
- Phil
Additionally do you think we should retire ComicPress altogether in favor of the better Comic Management Systems that are available?
What this does is give your users who do *not* have gravatars from gravatar.com when they post comments, custom avatars that you create. It will pick one from inside the directory and constantly use it based on the end users email address that they use when making a comment.
This code will only replace “default” avatars, not ones that people have made at gravatar.com.
The ComicPress and Easel themes already have this, this is a code snippet for ‘other’ themes.
This is not code for someone who is completely new to PHP and WordPress coding.
Include this into your functions.php file of your main theme you use, not the child theme. You will have to add it again if your theme updates. This is meant for theme author’s to include it in their themes on updates.
function frumph_random_default_avatar_callback( $id_or_email = '' ) {
if (!empty($id_or_email)) {
$count = count($results = glob(get_stylesheet_directory() . '/images/avatars/*'));
if ($count) {
$checknum = hexdec(substr(md5($id_or_email),0,5)) % $count;
if ($count > 0) {
$custom_avatar = basename($results[(int)$checknum]);
$replace_src_avatar = get_stylesheet_directory_uri().'/images/avatars/'.$custom_avatar;
return $replace_src_avatar;
}
} else
return get_option('avatar_default');
} else
return get_option('avatar_default');
}
THEN, you need to modify your get_avatar call in your theme (if your theme has it), this code is if your theme HAS a call to the get_avatar function.
What you do is you search for the function ‘get_avatar’ within the theme you are using, for example the thematic theme in the library/extensions/ has a file called ‘comments-extensions’ inside of it and the line with get_avatar looks like this:
$avatar = str_replace( "class='avatar", "class='photo avatar", get_avatar( $avatar_email, $avatar_size ) );
You want to modify the get_avatar function in it, the 3rd position is the the reference to the ‘default’ image, right after size, you will pass the email of the commenter to the function.
$avatar = str_replace( "class='avatar", "class='photo avatar", get_avatar( $avatar_email, $avatar_size, frumph_random_default_avatar_callback($avatar_email) ) );
In the twentytwelve theme, it’s in the content*.php files, looks something like this:
<?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentytwelve_author_bio_avatar_size', 68 ) ); ?>
You modify it to add the 3rd argument which changes the default image that it uses, with my code you also pass the email of the commenter in the function.
<?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentytwelve_author_bio_avatar_size', 68 ), frumph_random_default_avatar_callback(get_the_author_meta('user_email')) ); ?>
THEN
Add your images into the theme (or child theme’s) images/avatars/ directory so wp-content/themes/mychildtheme/images/avatars/ directory.
The reason I use get_stylesheet_directory is so that the images are retained in the child theme and if the child theme doesn’t exist the end user can put them in their main theme, but checks child theme first.
- Phil
Basically it removes an extra loop which wasn’t needed.
content-aside.php content.php content-comic.php content-page.php basically each ‘content type’ has their own php file (which is basically html), this will allow you to modify those ‘post areas’ display look and feel how you want them to in your child theme… basically copy the content- type file over to the child theme and hack away. You can also create other ‘content’ types which are commented out in the functions.php like for images and video’s etc if you want specific looks for your post areas for whatever content type you want.
n/t
IN the post info area, to the left of the title, the thumbnail will now display all mini like, instead of above everything, looks keen.
in the default style I added some ‘look’ to the post info (the header of each post) to denote it’s difference from the rest of the post.
opengraph = facebook – google, etc.
This one is very important to CSS skinners, #column no longer exists and it is now #content, so find-replace inside of your CSS file if you used it. This also paved the way to allow the use of Jetpack’s Infinite scrolling. Which allows people to keep scrolling down the page and new posts will pop up. (along with the post formats change)
NOTE edit the style.css, search for .post-image
.post-content .post-image {
float: left;
display: inline-block;
padding: 3px 3px 0;
border: solid 1px #ccc;
margin: 4px;
}
.post-content .post-image img {
width: 100px;
height: auto;
}
Fixes the issue with 3.3 with the post image in the title
IF you have layout-head.php in your child theme, make sure to change the id=”column” to id=”content” inside of that .php file
This will require some editing of your wp-content/themes/comicpress/functions/syndication.php file
Open up that file on your hosting and replace it with the code available here:
https://github.com/Frumph/comicpress/blob/master/functions/syndication.php
^ the github repo is where I store the latest of every edit I make, bug fixes and what not
If you are logged into github you can find a “zip” button to download the latest full master copy at http://github.com/Frumph/comicpress
Once you are done replacing that bit of code, you edit a post, save it which then updates your feed (clears your feed cache) then go to feedburner and click the resync button in your admin panel for feedburner
- Phil
NOTE: For older ComicPress versions, just replace this portion of the syndication.php file:
if (!function_exists('comicpress_insert_comic_feed')) {
function comicpress_insert_comic_feed($content) {
global $wp_query, $post;
$category = get_the_category($post->ID);
if (comicpress_in_comic_category($category[0]->cat_ID)) {
$content = comicpress_comic_feed().$content;
}
return apply_filters('comicpress_insert_comic_feed', $content);
}
}
add_filter('the_content_feed','comicpress_insert_comic_feed');
add_filter('the_excerpt_rss','comicpress_insert_comic_feed');
For ComicPress 2.8 open the syndication.php file and replace this:
//Insert the comic image into the RSS feed
function comicpress_comic_feed() {
global $post, $comicpress_options; ?>
<p><a href="<?php the_permalink() ?>"><?php echo comicpress_display_comic_image('rss,comic',$comicpress_options['enable_post_thumbnail_rss']); ?></a></p><?php
}
With this:
//Insert the comic image into the RSS feed
function comicpress_comic_feed() {
global $post, $comicpress_options; ?>
return '<p><a href="'.get_permalink().'">'.comicpress_display_comic_image('rss,comic',$comicpress_options['enable_post_thumbnail_rss']).'</a></p>';
}
Again what you’re doing is ‘returning’ info instead of echo’ing it out.
P.S. change the add_action for the_content to the_content_feed and the_excerpt_rss like the top example, just not the function name after it
For WAYYYY OLD Comicpress’
echo "<p><a href=\"";
the_permalink();
echo "\"><img src=\"$siteurl/$filename\" border=\"0\" alt=\"Cartoon
thumbnail - ";
the_title();
echo " - CLICK for full cartoon\" /></a></p>";
replace that section with this line (all on one line):
return '<p><a href="'.get_permalink().'"><img src="'.$siteurl.'/'.$filename.'" border="0" alt="Cartoon Thumbnail - '.get_the_title().' - Click for FULL Cartoon." /></a></p>';
The idea is to remove the ECHO’s and make it all RETURN
For ComicPress 2.5:
in the functions.php search for this:
function comic_feed() {
echo "<p><a href=\"";
the_permalink();
echo "\"><img src=\"";
echo get_comic_url('rss');
echo "\" border=\"0\" alt=\"";
echo the_title();
echo "\" /></a></p>";
}
replace it with this:
function comic_feed() {
return '<p><a href="'.get_permalink().'" title="'.get_the_title().'"><img src="'.get_comic_url('rss').'" border="0" alt="'.get_the_title().'" title="'.get_the_title().'"></a></p>';
}



