Skip to content

Instantly share code, notes, and snippets.

View bepatrickdavid's full-sized avatar

bepatrickdavid bepatrickdavid

View GitHub Profile
@bepatrickdavid
bepatrickdavid / gist:3d453f17b068bd514bcb
Last active August 29, 2015 14:25
WP: Sidebar Widget
//add sidebar
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('homepage-sidebar') ) : endif; ?>
@bepatrickdavid
bepatrickdavid / gist:07cf8d8bdb536ac3206b
Created July 20, 2015 14:58
CSS: center text div vertical and horizontal
position: absolute;
top: 50%;
left: 50%;
-ms-transform: translate(-50%,-50%);
-webkit-transform: translate(-50%,-50%);
-moz-transform: translate(-50%,-50%);
-o-transform: translate(-50%,-50%);
transform: translate(-50%,-50%);
@bepatrickdavid
bepatrickdavid / gist:926362d1894fc9aac4a9
Last active August 29, 2015 14:25
jQUERY: div same height as width 100% parent change dinamically
//html
<div class="home-item" style="background-image:url(http://placehold.it/500x500)"></div>
//css
.home-item {
width:20%;
background-position: center center;
background-repeat: no-repeat;
background-size: cover;
float: left;
}
@bepatrickdavid
bepatrickdavid / gist:5ad0f99097b71bcc9814
Created July 10, 2015 11:02
CSS: gradient over background image
.bg:before {
content: '';
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-color: rgba(0,0,0,0.3);
}
@bepatrickdavid
bepatrickdavid / functions.php
Last active August 29, 2015 14:24
PHP: Read RSS Feed with limit
function getFeed($feed_url, $limit) {
$content = file_get_contents($feed_url);
$x = new SimpleXmlElement($content);
echo "<ul>";
$count = $limit;
foreach($x->channel->item as $entry) {
@bepatrickdavid
bepatrickdavid / gist:5b3612713c4ffa0613c3
Created July 8, 2015 07:10
CSS: allineamento liste indentazione seconda terza riga
/* example */
ul li{
list-style:none;
text-indent: -1.5em;
padding-left: 3em;
}
@bepatrickdavid
bepatrickdavid / gist:1c0416437aab53b04446
Last active April 23, 2018 09:40
CSS: IE FIrefox Safari Hack
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
/* IE10+ specific styles go here */
.example {
overflow: visible !important;
}
}
@supports (-ms-accelerator:true) {
/* Edge */
}
@supports (-ms-ime-align:auto) {
@bepatrickdavid
bepatrickdavid / gist:0dda7e65c8d3edee3154
Created June 30, 2015 08:11
WP: Query with multiple post type limit to three item and order by date - Query diversi post type
<?php $any = get_posts( 'post_type[]=post&post_type[]=portfolio' ); ?>
<?php foreach(array_slice($any, 0, 3) as $a): ?>
<?php endforeach ?>
@bepatrickdavid
bepatrickdavid / footer.php
Last active September 29, 2015 09:44
WP: Template Tips codici tema intestazioni utili
@bepatrickdavid
bepatrickdavid / gist:f2b4e373c31e2147f452
Last active August 29, 2015 14:23
WP: shortcode video HTML5
function video_dp_shortcode( $atts ) {
extract( shortcode_atts(
array(
'poster' => NULL,
'mp4' => NULL,
'ogg' => NULL,
'webm' => NULL,
), $atts )
);