Skip to content

Instantly share code, notes, and snippets.

View laurelstreng's full-sized avatar

Laurel laurelstreng

View GitHub Profile
@laurelstreng
laurelstreng / page.tpl.php
Last active September 22, 2016 14:42
Drupal 7 - Theme Settings WYSIWYG Field
<?php if (theme_get_setting('features_title')): ?>
<div class="features-title">
<?php $featurestitle = theme_get_setting('features_title'); ?>
<?php print check_markup($featurestitle['value'], $featurestitle['format']); ?>
</div>
<?php endif; ?>
@laurelstreng
laurelstreng / page.tpl.php
Last active September 22, 2016 14:43
Drupal 7 - Theme Settings Image Field
<?php if (theme_get_setting('new_logo')): ?>
<div class="new-logo">
<?php
$fid = theme_get_setting('new_logo');
$image_url = file_create_url(file_load($fid)->uri);
?>
<img src="<?php echo $image_url; ?>"/>
</div>
<?php endif; ?>
@laurelstreng
laurelstreng / theme-settings.php
Created September 22, 2016 14:14
Drupal 7 - Theme Settings Fieldset (group) of Fields
function THEMENAME_form_system_theme_settings_alter(&$form, $form_state, $form_id = NULL){
// Set up the a fieldset (group) for general information
$form['general_info'] = array(
'#type' => 'fieldset',
'#title' => t('General Information'),
'#description' => t('General contact information for Duke Health & Fitness Center.'),
);
$form['general_info']['address'] = array(
'#type' => 'textfield',
'#title' => t('Address'),
@laurelstreng
laurelstreng / page.tpl.php
Created September 22, 2016 14:03
Drupal 7 - Print Views Block Content In Templates
<?php
$block = module_invoke('views', 'block_view', 'my_viewname-block');
print render($block);
?>
@laurelstreng
laurelstreng / .htaccess
Created November 1, 2014 23:19
Password protect your website using the .htaccess file
AuthName "Restricted Area"
AuthType Basic
AuthUserFile /full/path/name/.htpasswd
require valid-user