Skip to content

Instantly share code, notes, and snippets.

View kopepasah's full-sized avatar
🤖
Solving problems with bots.

Justin Kopepasah kopepasah

🤖
Solving problems with bots.
View GitHub Profile
@kopepasah
kopepasah / apple-touch-icons.html
Created July 17, 2012 21:07
Specifying a Webpage Icon for Web Clip on Apple iOS Devices
<!-- Size for iPhone and iPod touch - 57 x 57 (in pixels) -->
<link rel="apple-touch-icon" href="http://example.com/images/icon-57x57.png">
<!-- Size for high-resolution iPhone and iPod touch - 114 x 114 (in pixels) -->
<link rel="apple-touch-icon" sizes="114x114" href="http://example.com/images/icon-114x114.png">
<!-- Size for iPad - 72 x 72 (in pixels) -->
<link rel="apple-touch-icon" sizes="72x72" href="http://example.com/images/icon-72x72.png">
<!-- Size for high-resolution iPad - 144 x 144 (in pixels) -->
<link rel="apple-touch-icon" sizes="144x144" href="http://example.com/images/icon-144x144.png">
@kopepasah
kopepasah / archive-post-type.php
Created July 17, 2012 22:42
Order Custom Post Type Archive by Taxonomy in WordPress
<?php
/**
* Template for ordering custom post types by terms on
* on the post types archive.php
*
* @package WordPress
* @author Justin Kopepasah
*
*/
@kopepasah
kopepasah / git log bash function
Created October 3, 2012 16:00
Make git log command look pretty.
function glog() {
git log --pretty=format:"«––––––––––––––––––––––––––––––––––––––––––––––––––»%n%m%m%m %cn - %ce%n%m%m%m %Cblue%s%Creset%n%m%m%m %Cred%t%Creset%Cgreen%d%Creset%n%m%m%m %cr - %cd"
}
@kopepasah
kopepasah / shopp-account-menu.php
Created November 9, 2012 17:58
Creating an actual Shopp account menu for the account pages.
function shopp_account_menu() {
$shopp_pages = Storefront::pages_settings();
$site_url = str_replace( 'http://', '', get_bloginfo( 'url' ) );
$current_url = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
$needed_class = str_replace( $site_url . '/' . $shopp_pages['catalog']['slug'] . '/' . $shopp_pages['account']['slug'], '', $current_url );
if ( $needed_class == '/' ) {
$needed_class = str_replace( '/', 'profile', $needed_class );
} else {
$needed_class = str_replace( '/?', '', $needed_class );
@kopepasah
kopepasah / gist:4166783
Created November 29, 2012 04:18
Prevent Page Scroll When Clicking the More Link
function remove_more_link_scroll( $link ) {
$link = preg_replace( '|#more-[0-9]+|', '', $link );
return $link;
}
add_filter( 'the_content_more_link', 'remove_more_link_scroll' );
@kopepasah
kopepasah / html5-inputs.css
Created December 14, 2012 17:47
HTML5 input elements that need to be styled just like the text type input.
input[type="color"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="text"],
input[type="url"],
input[type="number"],
input[type="date"],
input[type="time"],
@kopepasah
kopepasah / filter-stylesheet-uri.php
Last active December 11, 2015 21:58
Use LESS in a live WordPress theme.
<?php
if ( ! function_exists( 'less_filter_stylesheet_uri' ) ) {
function less_filter_stylesheet_uri( $stylesheet_uri, $stylesheet_dir_uri ) {
$current_user = wp_get_current_user();
if ( $current_user->ID == '1' )
$src = $stylesheet_dir_uri . '/style.less';
else
$src = $stylesheet_dir_uri . '/style.min.css';
@kopepasah
kopepasah / dynamic-select-menu.php
Created February 2, 2013 00:18
This is an extension of the dynamic select menu function I wrote a while back. It will include children items of the top level parents.
<?php
function wp_nav_menu_select_sort( $a, $b ) {
return $a = $b;
}
function wp_nav_menu_select( $args = array() ) {
$defaults = array(
'theme_location' => '',
@kopepasah
kopepasah / footer-under-container.php
Last active December 12, 2015 03:08
This will hook the wp_footer(); hook under the Builder container (which is just before the closing body tag).
@kopepasah
kopepasah / gist-shortcode.php
Last active December 12, 2015 03:09
This gist shortcode with get the file content of each gist and output the contents for you site.
<?php
function gist_shortcode( $atts ) {
extract( shortcode_atts( array(
'user' => '',
'id' => '',
'file' => '',
), $atts ) );
if ( empty( $user ) | empty( $id ) | empty( $file ) )