Skip to content

Instantly share code, notes, and snippets.

View markbain's full-sized avatar
🎯
Focusing

Mark Bain markbain

🎯
Focusing
View GitHub Profile
@markbain
markbain / Lorem Shmorem
Last active December 22, 2015 00:09
A bit of Lorem Ipsum with formatting.
<strong>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</strong> Nullam vehicula mi quis tristique venenatis. Aenean ultricies porta enim non dapibus. Nam id purus sed mauris interdum pellentesque. Nunc tincidunt, sem id <a href="#">placerat pharetra</a>, eros orci varius dui, non adipiscing dui orci ut elit. Nunc volutpat elit augue, ut imperdiet nibh volutpat sit amet. Ut vel magna lectus. Integer hendrerit sapien non leo aliquam, eget ultrices lectus ullamcorper.
Integer convallis justo sed rhoncus tempus. Mauris porttitor ultricies turpis, vitae vestibulum turpis rutrum porttitor. Praesent feugiat odio quis <em>ligula ullamcorper vestibulum.</em> Nam tristique feugiat ultrices. Integer fringilla venenatis rhoncus. Vestibulum rhoncus commodo rutrum. Cras volutpat sem et convallis interdum. Phasellus dictum lacinia posuere. Vivamus id cursus magna. Duis facilisis mi facilisis tellus tincidunt varius. In egestas ipsum at odio ullamcorper pharetra.
@markbain
markbain / Borderlands
Created August 30, 2013 07:05
Adds subtle (or not so subtle, depending on the background) border to list items.
li {
border-top: 1px solid rgba(255,255,255,0.1);
border-bottom: 1px solid rgba(0,0,0,0.2);
}
li:first-child {
border-top: none;
}
li:last-child {
@markbain
markbain / WPCF7 Application Form better markup
Last active April 26, 2017 16:48
Add a few hooks for my CSS...
<h3 id="reply-title" class="comment-reply-title">Apply Now</h3>
<p class="comment-notes"><span id="email-notes">Your email address will not be published.</span> Required fields are marked <span class="required">*</span></p>
<div id="two-col-contact">
<div id="contact-message" class="contact-block">
<p>
<label>Your Cover Letter</label>
[textarea your-message placeholder "Your Cover Letter"]
</p>
</div>
@markbain
markbain / group posts by date
Last active August 29, 2015 13:55
group posts by date
<?php
$day_check = '';
while (have_posts()) : the_post();
$day = get_the_date('j');
if ($day != $day_check) {
if ($day_check != '') {
echo '</ul>'; // close the list here
}
echo get_the_date() . '<ul>';
}
<ul>
<?php foreach (get_terms( 'event-category' ) as $cat) : ?>
<li>
<img src="<?php echo z_taxonomy_image_url($cat->term_id); ?>" />
<a href="<?php echo get_term_link($cat->slug, 'event-category' ); ?>"><?php echo $cat->cat_name; ?></a>
</li>
<?php endforeach; ?>
</ul>
@markbain
markbain / Pop-up class
Created May 14, 2014 08:58
Looks for js-link-popup marked links and makes them open in a popup
/*
Looks for js-link-popup marked links and makes them open in a popup
Optionally allows width and height to be specified in the data attibutes on the <a>
*/
function processPopups(){
$("a.js-link-popup").click(function(event){
event.preventDefault();
var link = $(this);
var width = parseInt(link.data("width"))||600;
var height = parseInt(link.data("height"))||600;
@markbain
markbain / Numbered WordPress widgets
Created June 6, 2014 04:55
Add a number to each widget in the sidebar.
function my_widget_class($params) {
global $widget_num;
// Widget class
$class = array();
$class[] = 'widget';
// Iterated class
$widget_num++;
$class[] = 'widget-' . $widget_num;
@markbain
markbain / wp-config-master.php
Last active November 7, 2015 13:57
WP Config.php file
<?php
error_reporting(0); // otherwise WordPress overwrites the ALERTS set by PHP.INI
@ini_set('display_errors', 0); // otherwise WordPress overwrites the ALERTS set by PHP.INI
define('DB_NAME', '');
define('DB_USER', 'root');
define('DB_PASSWORD', '');
define('DB_HOST', 'localhost');
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');
@markbain
markbain / New CPT name
Created June 6, 2014 05:20
Change name of WordPress custom post type in database
UPDATE `wp_posts` SET `post_type` = 'NEW_CPT_NAME' WHERE `post_type` = 'OLD_CPT_NAME';
@markbain
markbain / Change WP custom tax name
Created June 6, 2014 05:21
Update the name of a WordPress custom taxonomy in the database
UPDATE 'wp_term_taxonomy' SET 'taxonomy' = 'NEW_TAX_NAME' WHERE 'taxonomy' = 'OLD_TAX_NAME';