Skip to content

Instantly share code, notes, and snippets.

Adam Clark avclark

View GitHub Profile
@avclark
avclark / .gitignore
Created Apr 17, 2018 — forked from salcode/.gitignore
See https://salferrarello.com/wordpress-gitignore/ for the latest version of my WordPress .gitignore file
View .gitignore
# -----------------------------------------------------------------
# .gitignore for WordPress
# Bare Minimum Git
# http://ironco.de/bare-minimum-git/
# ver 20150227
#
# This file is tailored for a WordPress project
# using the default directory structure
#
# This file specifies intentionally untracked files to ignore
View WP Query with Pagination
<?php
$temp = $wp_query;
$wp_query = null;
$wp_query = new WP_Query();
$wp_query->query('showposts=6&post_type=news'.'&paged='.$paged);
while ($wp_query->have_posts()) : $wp_query->the_post();
?>
<!-- LOOP: Usual Post Template Stuff Here-->
@avclark
avclark / .gitignore
Created Jul 6, 2017
git ignore boilerplate for WP
View .gitignore
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@avclark
avclark / footer-2-text-widget.html
Created May 9, 2016
The code used in the Text Widget in the Footer 2 Widget Area in the Community Pro Theme.
View footer-2-text-widget.html
@avclark
avclark / 0_reuse_code.js
Created Apr 15, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View gist:9a72d4051d8d46fce076bfb96aa3be3f
<?php
class Init_Menu_Item {
public function __construct() {
$this->initialize();
}
public function initialize() {
add_action( 'admin_menu', array( $this, 'init_menu_item') );
View Rem Mixin
@mixin rem( $property, $a:0, $b:$a, $c:$a, $d:$b ) {
@if ( $property == "font-size" ) {
// $a is the font size
// %b is the keyword
@if ( $a != $b ) {
font-size: $b;
}
@else {
font-size: $a * $base-font-multiplier * 16px;
}
@avclark
avclark / gist:7514123
Created Nov 17, 2013
Vertically center block elements
View gist:7514123
// We use this to vertically center block elements
.vertical-center {
&:before {
content: '';
display: inline-block;
height: 100%;
vertical-align: middle;
margin-right: -0.25em; /* Adjusts for spacing */
}
div {
@avclark
avclark / gist:7503165
Created Nov 16, 2013
Multi-environment config.php for Wordpress
View gist:7503165
<?php
/**
* The base configurations of the WordPress.
*
* This file has the following configurations: MySQL settings, Table Prefix,
* Secret Keys, WordPress Language, and ABSPATH. You can find more information
* by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
* wp-config.php} Codex page. You can get the MySQL settings from your web host.
*
* This file is used by the wp-config.php creation script during the
@avclark
avclark / gist:4072742
Created Nov 14, 2012
Simple PHP Contact Script
View gist:4072742
<?php
if(isset($_POST['email'])) {
// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "email@yourdomain.com";
$email_subject = "Email Subject line";
function died($error) {
?>
You can’t perform that action at this time.