Permalink
Browse files

added styles to get rid of crazy looking borders for social media plu…

…gins
  • Loading branch information...
1 parent 6a59fda commit f48d5f4bd98b0f08b6058274f7a5ac56c297bfd1 @indyplanets indyplanets committed Apr 17, 2012
Showing with 110 additions and 3 deletions.
  1. +30 −2 functions.php
  2. +74 −0 includes/widgets.php
  3. +6 −1 style.css
View
@@ -157,8 +157,10 @@ function remove_some_wp_widgets(){
unregister_widget('WP_Widget_Search');
}
- add_action('widgets_init', 'remove_some_wp_widgets', 1);
-
+ add_action('widgets_init', 'remove_some_wp_widgets', 1);
+
+ // register Category_Widget widget
+ add_action( 'widgets_init', create_function( '', 'register_widget( "category_widget" );' ) );
// Custom admin styles
function admin_register_head() {
@@ -1190,6 +1192,32 @@ function obfuscate($email){
}
+/**
+ * Category Loop function
+ *
+ * @return string|bool Category loop
+ */
+function cat_loop( $catClass ) {
+ global $post;
+ $cat_query = new WP_Query(
+ array(
+ 'posts_per_page' => 1
+ )
+ );
+ while ($cat_query->have_posts()) : $cat_query->the_post();
+ ?>
+ <h2 class="mb-post-title cat-post-title"><a href="<?php the_permalink();?>"><?php the_title(); ?></a></h2><a href="<?php the_permalink();?>">
+ <?php
+ if ( has_post_thumbnail() ) {
+ the_post_thumbnail('featured-mediabox');
+ } else {
+ echo '<img src="'.get_bloginfo("template_url").'/images/AgriLife-default-post-image.png" alt="AgriLife Logo" class="attachment-featured-mediabox wp-post-image .wp-post-image" title="AgriLife" />';
+ } ?></a>
+ <?php the_excerpt(); ?>
+ <?php endwhile; wp_reset_query();
+ return true;
+}
+
// Set path to function files
$includes_path = TEMPLATEPATH . '/includes/';
View
@@ -476,7 +476,81 @@ function agrilife_widget_agrilifetoday_rss_output( $rss, $args = array() ) {
}
+/**
+ * Adds Category Widget widget.
+ */
+class Category_Widget extends WP_Widget {
+
+ /**
+ * Register widget with WordPress.
+ */
+ public function __construct() {
+ parent::__construct(
+ 'category_widget', // Base ID
+ 'Categroy Widget', // Name
+ array( 'description' => __( 'A Category Widget', 'text_domain' ), ) // Args
+ );
+ }
+
+ /**
+ * Front-end display of widget.
+ *
+ * @see WP_Widget::widget()
+ *
+ * @param array $args Widget arguments.
+ * @param array $instance Saved values from database.
+ */
+ public function widget( $args, $instance ) {
+ extract( $args );
+ $category = apply_filters( 'widget_category', $instance['category'] );
+
+ echo $before_widget;
+ if ( ! empty( $title ) )
+ echo $before_title . $category . $after_title; ?>
+
+ <?php cat_loop($category) ?>
+
+ <?php echo $after_widget;
+ }
+
+ /**
+ * Sanitize widget form values as they are saved.
+ *
+ * @see WP_Widget::update()
+ *
+ * @param array $new_instance Values just sent to be saved.
+ * @param array $old_instance Previously saved values from database.
+ *
+ * @return array Updated safe values to be saved.
+ */
+ public function update( $new_instance, $old_instance ) {
+ $instance = array();
+ $instance['category'] = strip_tags( $new_instance['category'] );
+
+ return $instance;
+ }
+
+ /**
+ * Back-end widget form.
+ *
+ * @see WP_Widget::form()
+ *
+ * @param array $instance Previously saved values from database.
+ */
+ public function form( $instance ) {
+ if ( isset( $instance[ 'category' ] ) ) {
+ $category = $instance[ 'category' ];
+ } else {
+ $category = __( 'Enter Category', 'text_domain' );
+ } ?>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'category' ); ?>"><?php _e( 'Category:' ); ?></label>
+ <input class="widefat" id="<?php echo $this->get_field_id( 'category' ); ?>" name="<?php echo $this->get_field_name( 'category' ); ?>" type="text" value="<?php echo esc_attr( $category ); ?>" />
+ </p>
+ <?php
+ }
+} // class Category_Widget
View
@@ -2665,7 +2665,9 @@ img {
}
-
+/* =Plugin Styles
+-------------------------------------------------------------- */
+.addthis_toolbox a { border: none; }
/* =Comments
@@ -2690,6 +2692,9 @@ h3#comments-title {
list-style: none;
margin: 0;
}
+.commentlist li.odd {
+ background: #f4f3ea;
+}
.commentlist li.comment {
border-bottom: 1px solid #e7e7e7;
margin: 0 0 24px 0;

0 comments on commit f48d5f4

Please sign in to comment.