Skip to content

Commit

Permalink
Facebook Like options and widget completed
Browse files Browse the repository at this point in the history
blog post stays with comic (dual and single) adjusted and hopefully working properly, needs testing

Signed-off-by: Philip M. Hofer (Frumph) <frumph_dragon@yahoo.com>
  • Loading branch information
Philip M. Hofer (Frumph) committed Dec 12, 2010
1 parent fd36e98 commit 72d6a00
Show file tree
Hide file tree
Showing 11 changed files with 151 additions and 56 deletions.
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,9 @@
2.9.2.28 2.9.2.28
change the forum url to http://comicpress.net/forum/ bbpress wasnt working out, so switched to simple:press change the forum url to http://comicpress.net/forum/ bbpress wasnt working out, so switched to simple:press
added 2 new options on the comicpress-options post&pages tab, enable facebook like
added new widget, facebook like, that goes in any of the comic sidebars for better control where you might the like button to be
dual blog posts and checkmarked blog post stays with comic now works as properly designed
single blog posts and checkmarked blog posts stays with comic as well is now fixed (needs testing)


2.9.2.27 2.9.2.27
Stylized the control panel and dropdown archive boxes Stylized the control panel and dropdown archive boxes
Expand Down
4 changes: 3 additions & 1 deletion comicpress-admin.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ function comicpress_admin_options() {
'blogposts_with_comic', 'blogposts_with_comic',
'static_blog', 'static_blog',
'disable_page_titles', 'disable_page_titles',
'disable_post_titles' 'disable_post_titles',
'facebook_like_blog_post',
'facebook_like_comic_post'
) as $key) { ) as $key) {
if (!isset($_REQUEST[$key])) $_REQUEST[$key] = 0; if (!isset($_REQUEST[$key])) $_REQUEST[$key] = 0;
$comicpress_options[$key] = (bool)( $_REQUEST[$key] == 1 ? true : false ); $comicpress_options[$key] = (bool)( $_REQUEST[$key] == 1 ? true : false );
Expand Down
4 changes: 3 additions & 1 deletion functions.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -475,7 +475,9 @@ function comicpress_load_options() {
'enable_equal_height_sidebars' => false, 'enable_equal_height_sidebars' => false,
'prefab_design' => 'none', 'prefab_design' => 'none',
'copyright_name' => '', 'copyright_name' => '',
'copyright_url' => '' 'copyright_url' => '',
'facebook_like_blog_post' => false,
'facebook_like_comic_post' => false


) as $field => $value) { ) as $field => $value) {
$comicpress_options[$field] = $value; $comicpress_options[$field] = $value;
Expand Down
8 changes: 6 additions & 2 deletions functions/classes.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -98,9 +98,12 @@ function comicpress_post_class($classes = '') {


$is_comic = comicpress_in_comic_category(); $is_comic = comicpress_in_comic_category();


// This used to do something, it no longer does
/*
$args = array( $args = array(
'entry_tax' => array( 'category', 'post_tag' ) 'entry_tax' => array( 'category', 'post_tag' )
); );
*/


/* Microformats. */ /* Microformats. */
$classes[] = 'uentry'; $classes[] = 'uentry';
Expand All @@ -127,13 +130,14 @@ function comicpress_post_class($classes = '') {
if ( !is_attachment() ) if ( !is_attachment() )
$classes[] = 'post-author-' . sanitize_html_class( get_the_author_meta( 'user_nicename' ), get_the_author_meta( 'ID' ) ); $classes[] = 'post-author-' . sanitize_html_class( get_the_author_meta( 'user_nicename' ), get_the_author_meta( 'ID' ) );


/* User-created classes. */ /* User-created classes. This serves no purpose anymore */
/*
if ( !empty( $class ) ) : if ( !empty( $class ) ) :
if ( !is_array( $class ) ) if ( !is_array( $class ) )
$class = preg_split( '#\s+#', $class ); $class = preg_split( '#\s+#', $class );
$classes = array_merge( $classes, $class ); $classes = array_merge( $classes, $class );
endif; endif;

*/
/* Password-protected posts. */ /* Password-protected posts. */
if ( post_password_required() ) if ( post_password_required() )
$classes[] = 'protected'; $classes[] = 'protected';
Expand Down
17 changes: 16 additions & 1 deletion functions/displaypost.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -141,10 +141,24 @@ function comicpress_display_related_posts($is_comic = false) {
} }
} }


if (!function_exists('comicpress_display_facebook_like')) {
function comicpress_display_facebook_like($is_comic = false, $bypass = false) {
global $post, $wp_query;
if (!is_page()) {
if ($bypass || (($is_comic && comicpress_themeinfo('facebook_like_comic_post')) || (!$is_comic && comicpress_themeinfo('facebook_like_blog_post')))) {
$the_perma = rawurlencode(get_permalink());
$the_iframe = '<div class="facebook_like"><iframe src="http://www.facebook.com/plugins/like.php?href='.$the_perma.'&amp;layout=standard&amp;show_faces=true&amp;width=500&amp;action=like&amp;font=segoe+ui&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:500px; height:80px;" allowTransparency="true"></iframe></div>';
echo apply_filters('comicpress_display_facebook_like', $the_iframe);
}
}
echo apply_filters('comicpress_display_facebook_like', '');
}
}

if (!function_exists('comicpress_display_blog_navigation')) { if (!function_exists('comicpress_display_blog_navigation')) {
function comicpress_display_blog_navigation($is_comic = false) { function comicpress_display_blog_navigation($is_comic = false) {
global $post, $wp_query; global $post, $wp_query;
if (is_single() && !$is_comic && !is_page() && !is_archive() && !is_search()) { ?> if (is_single() && !$is_comic && !is_page() && !is_archive() && !is_search() && !comicpress_themeinfo('split_column_in_two') ) { ?>
<div class="blognav"> <div class="blognav">
<?php previous_post_link('<span class="blognav-prev">%link</span>',__(' &lsaquo; Previous ','comicpress'), TRUE); ?> <?php previous_post_link('<span class="blognav-prev">%link</span>',__(' &lsaquo; Previous ','comicpress'), TRUE); ?>
<?php next_post_link('<span class="blognav-next">%link</span>',__('Next &rsaquo; ','comicpress'), TRUE); ?> <?php next_post_link('<span class="blognav-next">%link</span>',__('Next &rsaquo; ','comicpress'), TRUE); ?>
Expand Down Expand Up @@ -237,6 +251,7 @@ function comicpress_display_post() {
<?php if (!is_page()) { ?> <?php if (!is_page()) { ?>
<div class="post-extras"> <div class="post-extras">
<?php comicpress_display_post_tags(); ?> <?php comicpress_display_post_tags(); ?>
<?php comicpress_display_facebook_like($is_comic); ?>
<?php comicpress_display_comment_link(); ?> <?php comicpress_display_comment_link(); ?>
<?php <?php
if ($is_comic) { if ($is_comic) {
Expand Down
40 changes: 32 additions & 8 deletions functions/dual-columns.php
Original file line number Original file line Diff line number Diff line change
@@ -1,30 +1,54 @@
<?php <?php


function comicpress_dual_filter_where($where = '') {
global $cur_date, $next_date, $prev_date;
if (!empty($next_date)) {
if (!empty($prev_date)) {
$where .= " AND post_date > '".$cur_date."' AND post_date < '".$next_date."'";
} else {
$where .= " AND post_date < '".$next_date."'";
}
} else {
$where .= " AND post_date >= '".$cur_date."'";
}
return $where;
}

if (!function_exists('comicpress_dual_columns')) { if (!function_exists('comicpress_dual_columns')) {
function comicpress_dual_columns() { function comicpress_dual_columns($whereclause = false) {
global $wp_query; global $wp_query;
?> ?>
<div id="dualcolumns"> <div id="dualcolumns">
<div class="column_one"> <div class="column_one">
<div class="column_one_header"></div> <div class="column_one_header"></div>
<?php <?php
Protect();
$wp_query->in_the_loop = true; $wp_query->in_the_loop = true;
$blog_query = new WP_Query(); $blog_query = new WP_Query();
if ($whereclause) add_filter('posts_where', 'comicpress_dual_filter_where');
$blog_query->query('showposts='.comicpress_themeinfo('blog_postcount').'&cat='.comicpress_exclude_comic_categories().'&author='.comicpress_themeinfo('author_column_one').'&paged='.$paged); $blog_query->query('showposts='.comicpress_themeinfo('blog_postcount').'&cat='.comicpress_exclude_comic_categories().'&author='.comicpress_themeinfo('author_column_one').'&paged='.$paged);
while ($blog_query->have_posts()) : $blog_query->the_post(); if (have_posts()) {
comicpress_display_post(); while ($blog_query->have_posts()) : $blog_query->the_post();
endwhile; comicpress_display_post();
endwhile;
}
UnProtect();
?> ?>
</div> </div>
<div class="column_two"> <div class="column_two">
<div class="column_two_header"></div> <div class="column_two_header"></div>
<?php <?php
Protect();
$wp_query->in_the_loop = true; $wp_query->in_the_loop = true;
$blog_query = new WP_Query(); $blog_query = new WP_Query();
if ($whereclause) add_filter('posts_where', 'comicpress_dual_filter_where');
$blog_query->query('showposts='.comicpress_themeinfo('blog_postcount').'&cat='.comicpress_exclude_comic_categories().'&author='.comicpress_themeinfo('author_column_two')); $blog_query->query('showposts='.comicpress_themeinfo('blog_postcount').'&cat='.comicpress_exclude_comic_categories().'&author='.comicpress_themeinfo('author_column_two'));
while ($blog_query->have_posts()) : $blog_query->the_post(); if (have_posts()) {
comicpress_display_post(); while ($blog_query->have_posts()) : $blog_query->the_post();
endwhile; comicpress_display_post();
endwhile;
}
UnProtect();
?> ?>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
Expand Down
31 changes: 31 additions & 0 deletions options/postoptions.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -39,6 +39,37 @@
</td> </td>
</tr> </tr>
</table> </table>

<table class="widefat">
<thead>
<tr>
<th colspan="3"><?php _e('Facebook Like','comicpress'); ?></th>
</tr>
</thead>
<tr>
<td colspan="5">
*Note: There is a Facebook Like Widget that you can place in any of the comic sidebars.
</td>
</tr>
<tr class="alternate">
<th scope="row"><label for="facebook_like_blog_post"><?php _e('Enable the Facebook Like button in Blog Posts?','comicpress'); ?></label></th>
<td>
<input id="facebook_like_blog_post" name="facebook_like_blog_post" type="checkbox" value="1" <?php checked(true, comicpress_themeinfo('facebook_like_blog_post')); ?> />
</td>
<td>
<?php _e('When enabled this option will allow the Facebook like button to appear at the bottom of regular blog posts.','comicpress'); ?>
</td>
</tr>
<tr class="alternate">
<th scope="row"><label for="facebook_like_comic_post"><?php _e('Enable the Facebook Like button in Comic Posts?','comicpress'); ?></label></th>
<td>
<input id="facebook_like_comic_post" name="facebook_like_comic_post" type="checkbox" value="1" <?php checked(true, comicpress_themeinfo('facebook_like_comic_post')); ?> />
</td>
<td>
<?php _e('Enabling this option will allow the Facebook like button to appear at the bottom of comic posts.','comicpress'); ?>
</td>
</tr>
</table>


<table class="widefat"> <table class="widefat">
<thead> <thead>
Expand Down
2 changes: 1 addition & 1 deletion options/themestyle.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function showimage(sel,pic) {
<div class="comicpress-options"> <div class="comicpress-options">


<div class="cpadmin-footer"> <div class="cpadmin-footer">
<div class="comicpress-forum">Forums are now at <a href="http://comicpress.net/forum/">http://comicpress.net/forum/</a> for Technical Assistance</div> <div class="comicpress-forum">Forums are at <a href="http://comicpress.net/forum/">http://comicpress.net/forum/</a> for Technical Assistance</div>
<div id="comicpress-version-title"><a href="http://comicpress.net/">ComicPress <?php echo comicpress_themeinfo('version'); ?></a></div> <div id="comicpress-version-title"><a href="http://comicpress.net/">ComicPress <?php echo comicpress_themeinfo('version'); ?></a></div>
<br /> <br />
<?php _e('Developed and maintained by','comicpress'); ?> <a href="http://frumph.net/">Philip M. Hofer</a> <small>(<a href="http://frumph.net/">Frumph</a>)</small>, <?php _e('Originally created by','comicpress'); ?> <a href="http://mindfaucet.com/">Tyler Martin</a><br /> <?php _e('Developed and maintained by','comicpress'); ?> <a href="http://frumph.net/">Philip M. Hofer</a> <small>(<a href="http://frumph.net/">Frumph</a>)</small>, <?php _e('Originally created by','comicpress'); ?> <a href="http://mindfaucet.com/">Tyler Martin</a><br />
Expand Down
82 changes: 47 additions & 35 deletions single.php
Original file line number Original file line Diff line number Diff line change
@@ -1,23 +1,32 @@
<?php <?php
get_header(); get_header();
if (comicpress_themeinfo('blogposts_with_comic')) {
Protect();
global $cur_date, $next_date, $prev_date;
$cur_date = $next_date = $prev_date = null;

$cur_date = mysql2date('Y-m-j', $post->post_date);
$next_comic = comicpress_get_next_comic();
$prev_comic = comicpress_get_previous_comic();
if (!empty($next_comic)) {
$next_comic = (array)$next_comic;
$next_date = mysql2date('Y-m-j', $next_comic['post_date']);
}
if (!empty($prev_comic)) {
$prev_comic = (array)$prev_comic;
$prev_date = mysql2date('Y-m-j', $prev_comic['post_date']);
}
UnProtect();
}

if (have_posts()) : if (have_posts()) :
while (have_posts()) : the_post(); while (have_posts()) : the_post();
if (comicpress_in_comic_category()) { $blog_query = 'showposts='.comicpress_themeinfo('blog_postcount').'&order=asc&cat='.comicpress_exclude_comic_categories();
if (!comicpress_themeinfo('disable_comic_blog_single')) { if (!comicpress_in_comic_category() || (comicpress_in_comic_category() && !comicpress_themeinfo('disable_comic_blog_single'))) {
comicpress_display_post();
$cur_date = mysql2date('Y-m-j', $post->post_date);
$next_comic = comicpress_get_next_comic();
if (!empty($next_comic)) {
$next_comic = (array)$next_comic;
$next_date = mysql2date('Y-m-j', $next_comic['post_date']);
}
$blog_query = 'showposts='.comicpress_themeinfo('blog_postcount').'&order=asc&cat='.comicpress_exclude_comic_categories();
}
} else {
comicpress_display_post(); comicpress_display_post();
comments_template('', true);
$blog_query = 'showposts='.comicpress_themeinfo('blog_postcount').'&order=asc&cat='.comicpress_exclude_comic_categories();
} }
comments_template('', true);

endwhile; endwhile;


if (is_active_sidebar('blog')) get_sidebar('blog'); if (is_active_sidebar('blog')) get_sidebar('blog');
Expand Down Expand Up @@ -49,28 +58,31 @@
} }
} else { } else {
if (comicpress_themeinfo('blogposts_with_comic')) { if (comicpress_themeinfo('blogposts_with_comic')) {

if (!comicpress_themeinfo('split_column_in_two')) {
$temppost = $post;
$temp_query = $wp_query; Protect();


if (comicpress_in_comic_category()) { if (comicpress_in_comic_category()) {
function filter_where($where = '') { function filter_where($where = '') {
global $cur_date, $next_date; global $cur_date, $next_date;
if (!empty($next_date)) { if (!empty($next_date)) {
$where .= " AND post_date >= '".$cur_date."' AND post_date <= '".$next_date."'"; $where .= " AND post_date >= '".$cur_date."' AND post_date <= '".$next_date."'";
} else { } else {
$where .= " AND post_date >= '".$cur_date."'"; $where .= " AND post_date >= '".$cur_date."'";
}
return $where;
} }
return $where; add_filter('posts_where', 'filter_where');
} $posts = &query_posts($blog_query);
add_filter('posts_where', 'filter_where'); if (have_posts()) { while (have_posts()) : the_post();
$posts = &query_posts($blog_query); comicpress_display_post();
if (have_posts()) { while (have_posts()) : the_post(); comments_template('', true);
comicpress_display_post(); endwhile; }
comments_template('', true); }
endwhile; } UnProtect();
} } else {
$post = $temppost; $wp_query = $temp_query; $temppost = null; $temp_query = null; comicpress_dual_columns(true);
}
} }
} }
else: else:
Expand Down
9 changes: 5 additions & 4 deletions style.css
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Theme Name: ComicPress Theme Name: ComicPress
Contributors: Frumph Contributors: Frumph
Theme URI: http://comicpress.net Theme URI: http://comicpress.net
Description: Publish a comic with WordPress. <a href="http://comicpress.net">Visit the ComicPress Website.</a> This is the ComicPress Core Framework. Requires WordPress 3.0 Description: Publish a comic with WordPress. Visit the ComicPress Website (<a href="http://comicpress.net">comicpress.net</a>). This is the ComicPress Core Framework. Requires WordPress 3.0
Author: Philip M. Hofer Author: Philip M. Hofer
Author URI: http://frumph.net Author URI: http://frumph.net
Tags: White, Two-Columns, Three-Columns, left-sidebar, right-sidebar, fixed-width, custom-header, theme-options, threaded-comments, sticky-post, translation-ready Tags: White, Two-Columns, Three-Columns, left-sidebar, right-sidebar, fixed-width, custom-header, theme-options, threaded-comments, sticky-post, translation-ready
Expand Down Expand Up @@ -1664,6 +1664,7 @@ textarea {
overflow: hidden; overflow: hidden;
} }


.tipjarunderbox { .post-extras .facebook_like {
background: url('images/gauge.png') top center no-repeat; clear: both;
} padding-top: 10px;
}
6 changes: 3 additions & 3 deletions widgets/facebooklike.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ function widget($args, $instance) {


echo $before_widget; echo $before_widget;
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']); $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
if ( !empty( $title ) ) { echo $before_title . $title . $after_title; }; ?> if ( !empty( $title ) ) { echo $before_title . $title . $after_title; };
<h2 class="randomcomic"><a href="/?randomcomic&nocache=1"><span class="random-comic-icon">?</span> <?php _e('Random Comic','comicpress'); ?></a></h2> // This only works in comic sidebar widgets, declare it to pass it as a comic.
<?php comicpress_display_facebook_like(true, true); // 2nd param is to bypass the check for $is_comic
echo $after_widget; echo $after_widget;
} }


Expand Down

0 comments on commit 72d6a00

Please sign in to comment.