vdchristelle
9/9/2013 - 7:33 AM

nieuwsitems uitvullen als er geen foto geupload is met jQuery of in preprocess_html()

nieuwsitems uitvullen als er geen foto geupload is met jQuery of in preprocess_html()

$(document).ready(function() {

  //optie 1
	$('.sidebar-menu').find('li.active').next().addClass('nextitem');
	$('.mainmenu').find('li.active').next().addClass('nextitem');

	//if news has no image, add extra classes
    if ( $('.node-nieuws-item .group-left .group_testimonial_img').length == 0) {
    	$('.node-nieuws-item .group-left').addClass('hide');
    	$('.node-nieuws-item .group-right').addClass('width_100');
    } else { alert('banan'); };


    //optie 2 lists
    $('.overview.news li').each(function(){
      if ($(this).find('.news-image').length == 0) {
        $(this).find('.editor').addClass('width_100');
      } 
    });

}); // end document.ready
function YOURTHEME_preprocess_html(&$variables) {
  // add no photo class
  if (arg(0) == 'node' && is_numeric(arg(1))) {
    $node = node_load(arg(1));
    switch ($node->type) {
      case 'page':
      if (empty($node->field_image)) {
        $variables['classes_array'][] = 'no-photo';
      }
      break;
    }
  }
}