Skip to content

Instantly share code, notes, and snippets.

makbeta

Block or report user

Report or block makbeta

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@makbeta
makbeta / country-code-top-level-domains.json
Last active Oct 23, 2018
A list of country code top-level domains and country names. Information is taken from https://icannwiki.org/Country_code_top-level_domain
View country-code-top-level-domains.json
let countryCodeTopLevelDomains=[
{
"code": ".ac",
"country": "Ascension Island"
},
{
"code": ".ad",
"country": "Andorra"
},
{
@makbeta
makbeta / drupal7-add-user-role.php
Last active Nov 18, 2015
Drupal 7: add user's role to the body class of the page
View drupal7-add-user-role.php
<?php
function mytheme_responsive_preprocess_html(&$variables, $hook) {
$body_classes = array($variables['classes_array']);
// The body tag's classes are controlled by the $classes_array variable. To
// remove a class from $classes_array, use array_diff().
//$variables['classes_array'] = array_diff($variables['classes_array'], array('class-to-remove'));
if ($variables['user']) {
foreach ($variables['user']->roles as $key => $role) {
$role_class = 'role-' . str_replace(' ', '-', $role);
@makbeta
makbeta / d7-disable-wysiwyg-set-format.php
Created Oct 8, 2015
D7 modules that sets default format for a field; disables Wisiwyg editor on a set field & summary
View d7-disable-wysiwyg-set-format.php
<?php
/**
* Implement hook_element_info_alter()
* Enable custom processing of a field in authoring form before it is rendered to the user
*
* @param array $elements
*/
function my_module_element_info_alter(&$elements) {
array_unshift($elements['text_format']['#pre_render'], 'my_module_process_text_format');
}
@makbeta
makbeta / d7-submitted-info
Last active Aug 29, 2015
Change submitted info line that automatically appears on posts in Drupal 7
View d7-submitted-info
<?php
THEME_preprocess_node(&$variables, $hook) {
if ($variables['submitted']) {
$variables['submitted'] = t('Posted by !username !datetime', array('!username' => $variables['name'], '!datetime' => format_date($variables['node']->created, 'custom', 'F j, Y')));
}
}
?>
@makbeta
makbeta / ckeditor.styles.js
Last active Aug 29, 2015
Creating custom classes in CKEditor in Drupal
View ckeditor.styles.js
if(typeof(CKEDITOR) !== 'undefined') {
CKEDITOR.stylesSet.add( 'drupal', [
// Block-level styles
{ name: 'Float Left', element: 'p', attributes: { 'class': 'left'} },
{ name: 'Float Right' , element: 'p', attributes: { 'class': 'right'} },
// Inline styles
{ name: 'Small Text', element: 'small' }
] );
@makbeta
makbeta / wordpress-change-admin-title-text.php
Created Oct 29, 2013
CHANGE THE “ENTER TITLE HERE” TEXT IN WORDPRESS
View wordpress-change-admin-title-text.php
<?php
function XXX_enter_title_here( $title ){
$screen = get_current_screen();
if ( 'custom_post_type' == $screen->post_type ) {
$title = 'Custom Post Type Title Text';
}
return $title;
}
@makbeta
makbeta / isMobile.html
Created Oct 14, 2013
Setting isMobile session variable for Luminate Online
View isMobile.html
<!-- Copyright 2010 Convio, Inc. -->
<!--
Conditional for detecting mobile devices
[[?xx::x[[S80:isMobile]]x::
isMobile is not yet set
[[?xx::x[[S80:UserAgentLowerCase]]x::
UserAgentLowerCase is not yet set
Convert User-Agent from HTTP request header to lower case
[[U0:UserAgentLowerCase=[[E130:"[[S50:User-Agent]]" "A" "a" replaceall "B" "b" replaceall "C" "c" replaceall "D" "d" replaceall "E" "e" replaceall "F" "f" replaceall "G" "g" replaceall "H" "h" replaceall "I" "i" replaceall "J" "j" replaceall "K" "k" replaceall "L" "l" replaceall "M" "m" replaceall "N" "n" replaceall "O" "o" replaceall "P" "p" replaceall "Q" "q" replaceall "R" "r" replaceall "S" "s" replaceall "T" "t" replaceall "U" "u" replaceall "V" "v" replaceall "W" "w" replaceall "X" "x" replaceall "Y" "y" replaceall "Z" "z" replaceall]]]]
@makbeta
makbeta / d7-node-fields-variables.php
Created Sep 26, 2013
Drupal7: Make node fields variables for global access
View d7-node-fields-variables.php
<?php
//this goes into template.php function
function theme_preprocess_page(&$variables, $hook) {
if(isset($variables['node'])) {
$node = node_load($variables['node']->nid);
if($node->type == 'homepage') {
$field_name1 = 'field_left';
$field_name2 = 'field_middle';
$field_name3 = 'field_right';
@makbeta
makbeta / force-layout-settings.php
Created Sep 16, 2013 — forked from studiopress/force-layout-settings.php
Wordpress: Genesis layout updates
View force-layout-settings.php
<?php
//* Do NOT include the opening php tag
//* Force content-sidebar layout setting
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_content_sidebar' );
//* Force sidebar-content layout setting
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_sidebar_content' );
//* Force content-sidebar-sidebar layout setting
@makbeta
makbeta / wordpress-genesis-page-layout.php
Created Sep 15, 2013
Wordpress: Genesis set page to full (or any other) width layout
View wordpress-genesis-page-layout.php
<?php
/*set the Genesis layout to full width or any other width
options as follows:
content-sidebar,
sidebar-content,
content-sidebar-sidebar,
sidebar-sidebar-content,
sidebar-content-sidebar,
full-width-content
*/
You can’t perform that action at this time.