By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,451 Members | 994 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,451 IT Pros & Developers. It's quick & easy.

2nd line indent on wrapped text?

P: 2
hey everyone

wasn't sure if this was an html or php issue. i'm working on a wordpress site (http://subt.net/wordpress) and having trouble figuring out how to indent the 2nd line of wrapped text w/in a .php widget. see full widget php code below.

on the subt.net/wordpress site, if you look under the 'up and coming shows' left sidebar widget, there's a show titled 'eli paperboy reed & the true loves'.. many of the show entries are only 1-lined, but in some cases it spills on the 2nd line. in those cases, i'd like the 2nd to indent so it lines up with the artist name instead of the show date.

i've tried adding nbsp's to the show's title. it's a quick fix and displays perfectly inside the widget, but the nbsp's are shown on other pages where the show title appears.

is there anyway format this using html w/in the php code? any help is greatly appreciated!

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. //Sidebar Widget file
  3.  
  4.  
  5. class ListCategoryPostsWidget extends WP_Widget{
  6.  
  7.     function ListCategoryPostsWidget() {
  8.         parent::WP_Widget(false, $name = 'ListCategoryPostsWidget');
  9.     }
  10.  
  11.     function widget($args, $instance) {
  12.         extract( $args );
  13.         $title = apply_filters('widget_title', $instance['title']);
  14.         $limit = (is_numeric($instance['limit'])) ? $instance['limit'] : 5;
  15.         $orderby = ($instance['orderby']) ? $instance['orderby'] : 'date';
  16.         $order = ($instance['order']) ? $instance['order'] : 'desc';
  17.         $exclude = ($instance['exclude'] != '') ? $instance['exclude'] : 0;
  18.         $excludeposts = ($instance['excludeposts'] != '') ? $instance['excludeposts'] : 0;
  19.         $offset = (is_numeric($instance['offset'])) ? $instance['offset'] : 0;
  20.         $category_id = $instance['categoryid'];
  21.         $dateformat = ($instance['dateformat']) ? $instance['dateformat'] : get_option('date_format');
  22.                 $showdate = ($instance['show_date'] == 'on') ? 'yes' : 'no';
  23.                 $showexcerpt = ($instance['show_excerpt'] == 'on') ? 'yes' : 'no';
  24.                 $showauthor = ($instance['show_author'] == 'on') ? 'yes' : 'no';
  25.                 $showcatlink = ($instance['show_catlink'] == 'on') ? 'yes' : 'no';
  26.  
  27.                 echo $before_widget;
  28.                 echo $before_title . $title . $after_title;
  29.                 $atts = array(
  30.                         'id' => $category_id,
  31.             'orderby' => $orderby,
  32.             'order' => $order,
  33.             'numberposts' => $limit,
  34.             'date' => $showdate,
  35.             'author' => $showauthor,
  36.             'dateformat' => $dateformat,
  37.             'template' => 'default',
  38.             'excerpt' => $showexcerpt,
  39.             'exclude' => $exclude,
  40.             'excludeposts' => $excludeposts,
  41.             'offset' => $offset,
  42.             //'tags' => '',
  43.             //'content' => 'no',
  44.                         'catlink' => $showcatlink
  45.                     );
  46.  
  47.                echo list_category_posts($atts);
  48.                echo $lcp_result;
  49.         echo $after_widget;
  50.     }
  51.  
  52.     /** @see WP_Widget::update */
  53.     function update($new_instance, $old_instance) {
  54.         return $new_instance;
  55.     }
  56.  
  57.     /** @see WP_Widget::form */
  58.     function form($instance) {
  59.         include('lcp_widget_form.php');
  60.     }
  61. }
  62. add_action('widgets_init', create_function('', 'return register_widget("listCategoryPostsWidget");'));
  63.  
  64. ?>
  65.  
Mar 25 '11 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.