theme

theme_pager

  1. /**
  2.  * Format a query pager.
  3.  *
  4.  * Menu callbacks that display paged query results should call theme('pager') to
  5.  * retrieve a pager control so that users can view other results.
  6.  * Format a list

add span wrapper to primary links

  1. <?php
  2. function overeasy_theme(&$existing, $type, $theme, $path) {
  3.   $hooks = genesis_theme($existing, $type, $theme, $path);
  4.   $hooks['primary_links'] = array(
  5.     'arguments' => array('links' =>

Re

  1. Some men find some facts about this good post  from various places. And one would offer to <a href=" http://www.essayslab.com">buy an essay</a> from the essay writers.

PHP help, printing a list instead of a table

  1. function template_preprocess_forum_topic_list(&$variables) {
  2.   global $forum_topic_list_header;
  3.  
  4.   // Create the tablesorting header.
  5.   $ts = tablesort_init($forum_topic_list_header);
  6.   $header =

In teasers, display only the first field item.

  1. <?php
  2. function YOURTHEME_preprocess_node(&$vars) {
  3.   // In teasers, display only the first field item.
  4.   if (!$vars['page'] && count($vars['node']->field_YOURFIELD > 1)) {
  5.     $first_item = $vars[

Theme function to render a Taxonomy tree as nested lists

  1. function theme_taxonomy_tree($vid) {
  2.   $terms = taxonomy_get_tree($vid);
  3.   $tree = array();
  4.   $items = array();
  5.   foreach($terms as $term) {
  6.     $items[$term->tid]['data'] = theme('term_in_tree', $term);
  7.     $tree[$term->tid] =& $items[$term->tid];
  8.     foreach($term->parents as $parent_tid) {
  9.       if($parent_tid != 0) {
  10.         unset($tree[$term->tid]);
  11.         $items[$parent_tid]['children'][$term->tid] =& $items[$term->tid];
  12.       }
  13.     }
  14.   }
  15.   return theme('item_list', array_values($tree));
  16. }

Fix for Add JavaScript to only one node

  1.  

Fix for theming views 2 field output

  1. function eieditions_preprocess_views_view_field(&$vars) {
  2.   $view  = $vars['view'];
  3.   $field = $vars['field'];
  4.   $row   = $vars['row'];
  5.  
  6.   if ($view->name == 'homepage_features' && $view->current_display == 'node_content_4') {
  7.  
  8.     // This is the only reliable way to find unique names for fields in rows
  9.     // containing custom fields.
  10.     $fields = array_keys($view->display_handler->get_handlers('field'));
  11.  
  12.     switch ($fields[$field->position]) {
  13.  
  14.       // 'nothing' is the figure field.
  15.       case 'nothing':
  16.         $node = node_load($row->node_node_data_field_banner_nid, $row->node_node_data_field_banner_vid);
  17.  
  18.         if (count($node->field_illustration)) {
  19.           // The node has illustration node references.
  20.           $illustration_node = node_load($node->field_illustration[0]['nid']);
  21.           // TODO: make this work for embedded images
  22.           $image = content_format('field_image', $illustration_node->field_image[0], 'wide16gold_default', $illustration_node);
  23.           $creator = content_format('field_creator', $illustration_node->field_creator[0], 'default', $illustration_node);
  24.           $publisher = content_format('field_publisher', $illustration_node->field_publisher[0], 'default', $illustration_node);
  25.         }
  26.         else {
  27.           // TODO: support decoration reference fields.
  28.         }
  29.  
  30.         $vars['output'] = theme('figure', $image, $creator, $publisher);
  31.         break;
  32.  
  33.       // 'nothing_1' is the author/publisher credit for the featured item.
  34.       case 'nothing_1':
  35.         $field_creator_value = $view->display_handler->get_handler('field', 'field_creator_value');
  36.         $field_publisher_value = $view->display_handler->get_handler('field', 'field_publisher_value');
  37.         $vars['output'] = '<div class="credit vcard">';
  38.         $vars['output'] .= '<span class="fn">'. $field_creator_value->render($row) .'</span>';
  39.         if ($field_publisher_value->render($row)) {
  40.           $vars['output'] .= '<span class="o">'. $field_publisher_value->render($row) .'</span>';
  41.         }
  42.         $vars['output'] .= '</div>';
  43.         break;
  44.     }
  45.   }
  46. }

theming views 2 field output

  1. function eieditions_preprocess_views_view_field(&$vars) {
  2.   $view  = $vars['view'];
  3.   $field = $vars['field'];
  4.   $row   = $vars['row'];
  5.  
  6.   if ($view->name == 'homepage_features' && $view->current_display == 'node_content_4') {
  7.  
  8.     // This is the only reliable way to find unique names for fields in rows
  9.     // containing custom fields.
  10.     $fields = array_keys($view->display_handler->get_handlers('field'));
  11.  
  12.     switch ($fields[$field->position]) {
  13.  
  14.       // 'nothing' is the figure field.
  15.       case 'nothing':
  16.         $node = node_load($row->node_node_data_field_banner_nid, $row->node_node_data_field_banner_vid);
  17.  
  18.         if (count($node->field_illustration)) {
  19.           // The node has illustration node references.
  20.           $illustration_node = node_load($node->field_illustration[0]['nid']);
  21.           // TODO: make this work for embedded images
  22.           $image = content_format('field_image', $illustration_node->field_image[0], 'wide16gold_default', $illustration_node);
  23.           $creator = content_format('field_creator', $illustration_node->field_creator[0], 'default', $illustration_node);
  24.           $publisher = content_format('field_publisher', $illustration_node->field_publisher[0], 'default', $illustration_node);
  25.         }
  26.         else {
  27.           // TODO: support decoration reference fields.
  28.         }
  29.  
  30.         $vars['output'] = theme('figure', $image, $creator, $publisher);
  31.         break;
  32.  
  33.       // 'nothing_1' is the author/publisher credit for the featured item.
  34.       case 'nothing_1':
  35.         $field_creator_value = $view->display_handler->get_handler('field', 'field_creator_value');
  36.         $field_publisher_value = $view->display_handler->get_handler('field', 'field_publisher_value');
  37.         $vars['output'] = '<div class="credit vcard">';
  38.         $vars['output'] .= '<span class="fn">'. $field_creator_value->render($row) .'</span>';
  39.         if ($field_publisher_value->render($row)) {
  40.           $vars['output'] .= '<span class="o">'. $field_publisher_value->render($row) .'</span>';
  41.         }
  42.         $vars['output'] .= '</div>';
  43.         break;
  44.     }
  45.   }
  46. }

Fix for Fix for Form theming

  1. <?php
  2. function formtheme_theme() {
  3.   return array(
  4.     'user_login' => array(
  5.       'arguments' => array('form' => array()),
  6.       'path' => drupal_get_path('theme', 'formtheme') .
Syndicate content