Skip to content

Instantly share code, notes, and snippets.

View driesdelaey's full-sized avatar

Dries Delaey driesdelaey

  • Koksijde
View GitHub Profile
@driesdelaey
driesdelaey / template.php
Created September 25, 2012 12:43
truncate breadcrumbtitle
/**
* THEMING BREADCRUMBS
*/
function myubertheme_breadcrumb($variables) {
$breadcrumb = $variables['breadcrumb'];
if (!empty($breadcrumb)) {
// Provide a navigational heading to give context for breadcrumb links to
// screen-reader users. Make the heading invisible with .element-invisible.
@driesdelaey
driesdelaey / autoclick.js
Created September 19, 2012 13:25
JS get querystring 'the_link' and onload : trigger click on link with the class 'the_link'
$(document).ready(function() {
/* FUNCTION TO READ QUERYSTRING PARAM */
$.urlParam = function(name){
var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
if (!results) { return 0; }
return results[1] || 0;}
/* GET URLPARAM MONTH */
@driesdelaey
driesdelaey / activatemenu.module
Created September 7, 2012 12:49
Custom module to set the activetrail in your menu on a certain content type
<?php
/**
* Implements hook_node_view().
*/
function activatemenu_node_view($node, $view_mode, $langcode) {
// Check for nodes of type "Service".
if($node->type == 'news'){
menu_tree_set_path('main-menu', 'node/56');
@driesdelaey
driesdelaey / field--field-image.tpl.php
Created September 6, 2012 20:13
Theming a (multi-) image field
<?php if ($element['#view_mode'] == "full") { // styling image in full display mode?>
<div class="flexslider"<?php print $attributes; ?>>
<ul class="slides"<?php print $content_attributes; ?>>
<?php foreach ($items as $delta => $item): ?>
<li<?php print $item_attributes[$delta]; ?>><?php print render($item); ?></li>
<?php endforeach; ?>
</ul>
</div>
@driesdelaey
driesdelaey / template.php
Created May 10, 2012 11:59
Printing field+label in preprocess_node
<?php
function mytheme_preprocess_node(&$vars,$hook) {
// PRODUCTTABS
if($vars['type'] == 'products' && $vars['view_mode'] == 'full') {
// CHECK IF NODE HAS TECHINFO
if (isset($vars['field_technische_informatie'][0])) {