Skip to content

Instantly share code, notes, and snippets.

View phpbits's full-sized avatar
🎯
Focusing

Jeffrey Carandang phpbits

🎯
Focusing
View GitHub Profile
@phpbits
phpbits / widget.css
Created May 13, 2016 10:51
Manually Adding Custom Styles to WordPress Widgets
.widget_search#search-4{
background-color: #19a87d;
color: #fff;
}
.widget_search#search-4 .widget-title{
color: #fff;
border: 1px solid #fff;
}
@phpbits
phpbits / Hosting contract killer
Created February 27, 2016 12:00 — forked from MikeRawlins/Hosting contract killer
This is an additional paragraph for the excellent Contract Killer https://gist.github.com/malarkey/4031110
Hosting
We provide hosting for our own built websites on our preferred hosting provider <hosting provider name>.
Based on their SLA we endeavor to have 99.9% uptime on our servers measured annually.
There may of course be times when the server will not be available, this can be scheduled or unscheduled.
Scheduled downtime is when we know it is going to happen and tell you about it in advance. Scheduled downtime will wherever possible, almost certainly be outside of normal office hours. We’ll do our stuff in the evening or at weekend to minimize impact on your business.
There may be very rare occasions when we need to restart the server during normal office hours and it is not possible to inform you before hand. We don’t make these decisions lightly and if this does happen we apologise.
@phpbits
phpbits / Contract Killer 3.md
Created February 27, 2016 11:58
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: October 8th 2015
  • Original post

@phpbits
phpbits / footer.php
Created November 6, 2015 06:55
Move Genesis Hero Section
@phpbits
phpbits / style.css
Created November 6, 2015 05:42
Remove Hero Padding
.hero4genesis-behind-header .hero4genesis-behind{ padding: 0px; }
@phpbits
phpbits / below_header.php
Created November 6, 2015 04:44
Display Hero for Genesis Below the Header Section
<?php
/*
* Override Settings Option for Full Height & Behind Header
*/
add_filter('hero4genesis_class', 'hero_below_header');
function hero_below_header($class){
if( is_page() ){
$key = array_search('hero4genesis-behind', $class);
unset($class[ $key ]);
@phpbits
phpbits / header.php
Created November 6, 2015 04:29
Filter Hero for Genesis Header Display
<?php
/*
* Remove Full Height Hero Display
*/
add_filter('hero4genesis_class', 'hero_class_filter');
function hero_class_filter($class){
if( is_page( 'behind-header-not-full-height' ) ){
$key = array_search('hero4genesis-full', $class);
unset($class[ $key ]);
@phpbits
phpbits / homepage_only.php
Created November 6, 2015 03:48
Display Genesis Hero Section on Homepage Only
<?php
/*
* Display Hero Section on Homepage Only
*/
add_action( 'genesis_header', 'hero_homepage_only', 99 );
function hero_homepage_only(){
if( !is_front_page() && !is_home() ){
remove_action( 'genesis_after_header', 'do_hero4genesis', 99 );
}
}
@phpbits
phpbits / images.php
Last active November 17, 2016 04:45
Automatically replace original uploaded image with large image size
<?php
/*
* Remove Original Uploaded images
* retain large size image
*/
add_filter('wp_generate_attachment_metadata','phpbits_replace_uploaded_image');
function phpbits_replace_uploaded_image($image_data) {
// if there is no large image : return
if (!isset($image_data['sizes']['large'])) return $image_data;
@phpbits
phpbits / functions.php
Last active October 23, 2015 08:38
Hide Attachment
<?php
/*
* Hide Media Images
*/
add_filter( 'posts_where', 'hide_attachments_wpquery_where' );
function hide_attachments_wpquery_where( $where ){
global $current_user;
if( !current_user_can( 'manage_options' ) ) {
if( is_user_logged_in() ){
if( isset( $_POST['action'] ) ){