Permalink
Browse files

Facebook Like options and widget completed

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...
1 parent fd36e98 commit 72d6a00ffd1e7d048d2d80fe9f4771e28eff155a Philip M. Hofer (Frumph) committed Dec 12, 2010
View
@@ -1,5 +1,9 @@
2.9.2.28
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
Stylized the control panel and dropdown archive boxes
View
@@ -127,7 +127,9 @@ function comicpress_admin_options() {
'blogposts_with_comic',
'static_blog',
'disable_page_titles',
- 'disable_post_titles'
+ 'disable_post_titles',
+ 'facebook_like_blog_post',
+ 'facebook_like_comic_post'
) as $key) {
if (!isset($_REQUEST[$key])) $_REQUEST[$key] = 0;
$comicpress_options[$key] = (bool)( $_REQUEST[$key] == 1 ? true : false );
View
@@ -475,7 +475,9 @@ function comicpress_load_options() {
'enable_equal_height_sidebars' => false,
'prefab_design' => 'none',
'copyright_name' => '',
- 'copyright_url' => ''
+ 'copyright_url' => '',
+ 'facebook_like_blog_post' => false,
+ 'facebook_like_comic_post' => false
) as $field => $value) {
$comicpress_options[$field] = $value;
View
@@ -98,9 +98,12 @@ function comicpress_post_class($classes = '') {
$is_comic = comicpress_in_comic_category();
+// This used to do something, it no longer does
+/*
$args = array(
'entry_tax' => array( 'category', 'post_tag' )
);
+*/
/* Microformats. */
$classes[] = 'uentry';
@@ -127,13 +130,14 @@ function comicpress_post_class($classes = '') {
if ( !is_attachment() )
$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 ( !is_array( $class ) )
$class = preg_split( '#\s+#', $class );
$classes = array_merge( $classes, $class );
endif;
-
+*/
/* Password-protected posts. */
if ( post_password_required() )
$classes[] = 'protected';
View
@@ -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')) {
function comicpress_display_blog_navigation($is_comic = false) {
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">
<?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); ?>
@@ -237,6 +251,7 @@ function comicpress_display_post() {
<?php if (!is_page()) { ?>
<div class="post-extras">
<?php comicpress_display_post_tags(); ?>
+ <?php comicpress_display_facebook_like($is_comic); ?>
<?php comicpress_display_comment_link(); ?>
<?php
if ($is_comic) {
View
@@ -1,30 +1,54 @@
<?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')) {
- function comicpress_dual_columns() {
- global $wp_query;
+ function comicpress_dual_columns($whereclause = false) {
+ global $wp_query;
?>
<div id="dualcolumns">
<div class="column_one">
<div class="column_one_header"></div>
<?php
+ Protect();
$wp_query->in_the_loop = true;
$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);
- while ($blog_query->have_posts()) : $blog_query->the_post();
- comicpress_display_post();
- endwhile;
+ if (have_posts()) {
+ while ($blog_query->have_posts()) : $blog_query->the_post();
+ comicpress_display_post();
+ endwhile;
+ }
+ UnProtect();
?>
</div>
<div class="column_two">
<div class="column_two_header"></div>
<?php
+ Protect();
$wp_query->in_the_loop = true;
$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'));
- while ($blog_query->have_posts()) : $blog_query->the_post();
- comicpress_display_post();
- endwhile;
+ if (have_posts()) {
+ while ($blog_query->have_posts()) : $blog_query->the_post();
+ comicpress_display_post();
+ endwhile;
+ }
+ UnProtect();
?>
</div>
<div class="clear"></div>
View
@@ -39,6 +39,37 @@
</td>
</tr>
</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">
<thead>
View
@@ -11,7 +11,7 @@ function showimage(sel,pic) {
<div class="comicpress-options">
<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>
<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 />
View
@@ -1,23 +1,32 @@
<?php
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()) :
while (have_posts()) : the_post();
- if (comicpress_in_comic_category()) {
- if (!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 {
+ $blog_query = 'showposts='.comicpress_themeinfo('blog_postcount').'&order=asc&cat='.comicpress_exclude_comic_categories();
+ if (!comicpress_in_comic_category() || (comicpress_in_comic_category() && !comicpress_themeinfo('disable_comic_blog_single'))) {
comicpress_display_post();
+ comments_template('', true);
+ $blog_query = 'showposts='.comicpress_themeinfo('blog_postcount').'&order=asc&cat='.comicpress_exclude_comic_categories();
}
- comments_template('', true);
-
endwhile;
if (is_active_sidebar('blog')) get_sidebar('blog');
@@ -49,28 +58,31 @@
}
} else {
if (comicpress_themeinfo('blogposts_with_comic')) {
-
- $temppost = $post;
- $temp_query = $wp_query;
-
- if (comicpress_in_comic_category()) {
- function filter_where($where = '') {
- global $cur_date, $next_date;
- if (!empty($next_date)) {
- $where .= " AND post_date >= '".$cur_date."' AND post_date <= '".$next_date."'";
- } else {
- $where .= " AND post_date >= '".$cur_date."'";
+ if (!comicpress_themeinfo('split_column_in_two')) {
+
+ Protect();
+
+ if (comicpress_in_comic_category()) {
+ function filter_where($where = '') {
+ global $cur_date, $next_date;
+ if (!empty($next_date)) {
+ $where .= " AND post_date >= '".$cur_date."' AND post_date <= '".$next_date."'";
+ } else {
+ $where .= " AND post_date >= '".$cur_date."'";
+ }
+ return $where;
}
- return $where;
- }
- add_filter('posts_where', 'filter_where');
- $posts = &query_posts($blog_query);
- if (have_posts()) { while (have_posts()) : the_post();
- comicpress_display_post();
- comments_template('', true);
- endwhile; }
- }
- $post = $temppost; $wp_query = $temp_query; $temppost = null; $temp_query = null;
+ add_filter('posts_where', 'filter_where');
+ $posts = &query_posts($blog_query);
+ if (have_posts()) { while (have_posts()) : the_post();
+ comicpress_display_post();
+ comments_template('', true);
+ endwhile; }
+ }
+ UnProtect();
+ } else {
+ comicpress_dual_columns(true);
+ }
}
}
else:
View
@@ -2,7 +2,7 @@
Theme Name: ComicPress
Contributors: Frumph
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 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
@@ -1664,6 +1664,7 @@ textarea {
overflow: hidden;
}
-.tipjarunderbox {
- background: url('images/gauge.png') top center no-repeat;
-}
+.post-extras .facebook_like {
+ clear: both;
+ padding-top: 10px;
+}
View
@@ -23,9 +23,9 @@ function widget($args, $instance) {
echo $before_widget;
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['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>
- <?php
+ if ( !empty( $title ) ) { echo $before_title . $title . $after_title; };
+ // This only works in comic sidebar widgets, declare it to pass it as a comic.
+ comicpress_display_facebook_like(true, true); // 2nd param is to bypass the check for $is_comic
echo $after_widget;
}

0 comments on commit 72d6a00

Please sign in to comment.