Skip to content

Instantly share code, notes, and snippets.

View driesdelaey's full-sized avatar

Dries Delaey driesdelaey

  • Koksijde
View GitHub Profile
@driesdelaey
driesdelaey / single-portfolio.php
Last active December 11, 2015 11:19
get attachments from a post > order by menu (= manual order in the insert/upload media > gallery)
<ul>
$args = array(
'order' => 'DESC',
'orderby' => 'menu_order',
'post_type' => 'attachment',
'post_parent' => $post->ID,
'post_mime_type' => 'image',
'post_status' => null,
'numberposts' => -1,
);
(function($){
$(document).ready(function(){
// THEMANAV SPLIT DROPDOWN
$("#themas li ul").each(function() {
var aantal = $(this).children(' li').length; // tel aantal li's
if (aantal > 16 ) {
@driesdelaey
driesdelaey / stylesheet.css
Created December 3, 2012 12:52
doubleborder effect with text-shadow
/* DOUBLE SHADOW ON A GREY BGR */
.class{
border-left: 1px solid #fff;
box-shadow: -1px 0 0 0 #ccc;
}
@driesdelaey
driesdelaey / node.tpl.php
Created November 13, 2012 07:51
add querystring to a link within drupal's l-function
<?php
$options = array(
'attributes' => array('class' => 'fancybox btn'),
'query' => array('popup' => TRUE)
);
print l('Download patiëntenfolders', 'overzicht-folders/'.$node->nid, $options);
?>
@driesdelaey
driesdelaey / template.php
Created November 12, 2012 13:02
set taxonomy as class on node detail / set parent taxonomy term on term detail
function community_preprocess_html(&$vars) {
// set thema_[tid] class when on node detail
if(isset($vars['page']['content']['system_main']['nodes'])) {
$node = reset($vars['page']['content']['system_main']['nodes']);
if(isset($node['field_thema']['#items'][0]['tid'])){
$vars['classes_array'][] = 'thema_' . $node['field_thema']['#items'][0]['tid'];
}
}
// set parent level thema_[tid] class on taxonomy detail
@driesdelaey
driesdelaey / bookmarklet.html
Created November 6, 2012 09:57
Bookmarklet to go to Drupal's Performance page
<!DOCTYPE html >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Bookmarklet </title>
</head>
<body>
@driesdelaey
driesdelaey / header.php
Created October 24, 2012 08:29
print image_field as background image
print '<div class="visual" style="background-image: url(' . file_create_url($header_waarde['#item']['uri']) . ');"></div>';
#crappycode :-)
@driesdelaey
driesdelaey / page.tpl.php
Created October 1, 2012 13:18
print language dependant logo from theme folder on frontpage
<?php if ($is_front): ?>
<img src="<?php print base_path() . path_to_theme(); ?>/img/logo-<?php print $activelang; ?>.png" class="logo" />
<?php endif; ?>
@driesdelaey
driesdelaey / template.php
Created September 26, 2012 14:50
update jquery for frontend only
/**
* UPDATE JQUERY FOR FRONTEND ONLY
*/
function MYTHEME_js_alter(&$javascript) {
// Swap out jQuery to use an updated version of the library.
$javascript['misc/jquery.js']['data'] = drupal_get_path('theme', 'MYTHEME').'/js/jquery-1.7.2.min.js';
}
@driesdelaey
driesdelaey / template.php
Created September 26, 2012 14:48
theme a specific menu
function MYTHEME_menu_tree__MY_MENU_NAME(&$variables) {
return '<div class="thespecialwrapperclassiwant"><ul class="menu nav">' . $variables['tree'] . '</ul></div>';
}