Skip to content

Instantly share code, notes, and snippets.

View richlloydmiles's full-sized avatar

Richard richlloydmiles

View GitHub Profile
@richlloydmiles
richlloydmiles / alternate count
Created September 1, 2014 07:18
Alternative to counter variable
<!-- use this as oppsed to a $count ++ var -->
<?php
if($id !== end($type[0])){ echo ',';}
?>
<!-- the end() checks if its the last value and reset() checks if it is the first. -->
@richlloydmiles
richlloydmiles / background-img.php
Last active August 29, 2015 14:06
Background Image
<style>
.background-img {
width: 100%;
/*set the height to a fix value*/
height: 260px;
background-repeat: no-repeat;
/*set the focal point*/
background-position: top;
background-size: cover;
}
<?php
ob_start();
wp_nav_menu(array('theme_location' => 'primary', 'menu_class' => 'nav navbar-nav'));
$output = htmlspecialchars(ob_get_contents());
ob_end_clean();
$menu_items = substr_count($output,'li class');
?>
@richlloydmiles
richlloydmiles / gist:c5a41be4c152a0cf5370
Last active August 29, 2015 14:06
Custom wordpress query
<?php
$post_args = array(
'post_type' => 'video',
'post_status' => 'publish',
'posts_per_page' => '0',
'meta_key' => 'bs_video_featured',
'meta_value' => 1
);
$post = new WP_Query( $post_args );
if($post->have_posts()){
@richlloydmiles
richlloydmiles / gist:a9f7600a63752b8ff7e7
Last active August 29, 2015 14:06
owl slider implementation
<script>
jQuery(document).ready(function() {
jQuery('#featured-slider-<?php echo $carousel_id;?>').owlCarousel({
navSpeed: 400,
items: 1 ,
autoplay:false ,
autoplayTimeout:10000 ,
nav : true,
navText: [ '<i class="fa-chevron-left fa slider-chev featured-left-chev" ></i>' ,
'<i class="fa-chevron-right fa slider-chev featured-right-chev"></i>'] ,
col-sm-push-6
col-sm-6
@richlloydmiles
richlloydmiles / gist:da031ad1e9cc1c14dd96
Created September 22, 2014 16:39
background opacity
background : none repeat scroll 0 0 rgba(255, 255, 255, 0.85);
@richlloydmiles
richlloydmiles / gist:c903a04be3d52f1130d0
Created September 22, 2014 18:45
Bootstrap Media Queries
/* Large desktop */
@media (min-width: 1200px) { ... }
/* Portrait tablet to landscape and desktop */
@media (min-width: 768px) and (max-width: 979px) { ... }
/* Landscape phone to portrait tablet */
@media (max-width: 767px) { ... }
/* Landscape phones and down */
@richlloydmiles
richlloydmiles / gist:3d8086f5fcb226e75f90
Created September 28, 2014 07:46
Symfony2 tutorial notes
Add object to db via doctrine
use Yoda\EventBundle\Entity\Event;
$event= new Event();
$event->setName('Richard');
$event->setLocation('DeathStar');
$event->setTime(new \DateTime('tomorrow noon'));
$event->setDetails('HA!, Darth Hates suprises');
@richlloydmiles
richlloydmiles / gist:403739e95dfe0d18947a
Created October 1, 2014 08:57
Shorthand if statement
$var = ($temp = 1 ? 'true' : 'false') ;