Skip to content

Instantly share code, notes, and snippets.

View oliwa's full-sized avatar

Oliver Hulisz oliwa

View GitHub Profile
@oliwa
oliwa / HTML5 Template
Created February 24, 2014 11:18
Basic HTML5 Template
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>The HTML5 Herald</title>
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<meta name="description" content="The HTML5 Herald">
<meta name="author" content="SitePoint">
@oliwa
oliwa / wp_config.php Template
Last active June 7, 2024 13:13
wp_config.php Template
<?php
define('DB_NAME', 'database_name_here');
define('DB_USER', 'username_here');
define('DB_PASSWORD', 'password_here');
define('DB_HOST', 'localhost');
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');
// salt security keys, see https://api.wordpress.org/secret-key/1.1/salt/
@oliwa
oliwa / Basic CSS3 Snippets
Created February 24, 2014 11:28
Collection of basic CSS3 Snipptes
.box-sizing {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.border-radius {
padding: 10px;
-webkit-border-radius: 15px;
@oliwa
oliwa / functions.php
Last active December 5, 2018 07:11
Collection of usefull snippets for the functions.php
// adding blogname to body_class(),
// see http://www.be-studios.com/blog/2012/11/wordpress-multisite-adding-blogname-to-body_class/
add_filter('body_class', 'multisite_body_classes');
function multisite_body_classes($classes) {
$id = get_current_blog_id();
$slug = strtolower(str_replace(' ', '-', trim(get_bloginfo('name'))));
$classes[] = $slug;
$classes[] = 'site-id-'.$id;
return $classes;
@oliwa
oliwa / order query
Created May 8, 2015 08:59
Order Query
<?
if(isset($_get['order']) == 'asc'){
query_posts('order=asc');
}else if(isset($_get['order']) == 'desc'){
query_posts('order=desc');
}
?>
<a href="?order=ASC">Ascending</a>
<a href="?order=DESC">Descending</a>
@oliwa
oliwa / is_tree
Last active December 5, 2018 07:11
WP: is_tree
function is_tree($pid)
{
global $post;
$ancestors = get_post_ancestors($post->$pid);
$root = count($ancestors) - 1;
$parent = $ancestors[$root];
if(is_page() && (is_page($pid) || $post->post_parent == $pid || in_array($pid, $ancestors)))
{
@oliwa
oliwa / snippet.php
Last active December 5, 2018 07:11
Order a Query
<?
if(isset($_get['order']) == 'asc'){
query_posts('order=asc');
}else if(isset($_get['order']) == 'desc'){
query_posts('order=desc');
}
?>
<a href="?order=ASC">Ascending</a>
<a href="?order=DESC">Descending</a>
@oliwa
oliwa / snippet.php
Created November 19, 2015 09:59
Conditional with a date
<?php
$currentdate = date('Y-m-d');
$mydate = '2015-02-08';
if($currentdate >= $mydate) {
?>
<h1>later than mydate</h1>
<?php } else { ?>
<h1>earlier than mydate</h1>
<?php } ?>
@oliwa
oliwa / snippet.php
Created November 19, 2015 09:59
Random Select
<!-- load a random image -->
<figure>
<img src="/images/visual-<?php echo(rand(1,5)); ?>" />
</figure>
<!-- Display random snippet -->
<?php
$snippet[] = '<h2>Snippet 1</p>';
@oliwa
oliwa / functions.php
Created November 19, 2015 10:02
changing default wordpres email settings
// changing default wordpres email settings
add_filter('wp_mail_from', 'new_mail_from');
add_filter('wp_mail_from_name', 'new_mail_from_name');
function new_mail_from($old) {
return '[email protected]';
}
function new_mail_from_name($old) {
return 'MAP BioPharma';
}