Skip to content

Instantly share code, notes, and snippets.

Adam Clark avclark

Block or report user

Report or block avclark

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
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
@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') );
@avclark
avclark / presale app
Created Dec 25, 2014
presale app jquery modifications
View presale app
// Here are some of the changes I made to these two functions, but this broke the whole, I was getting an error saying something like unidentified param: amount, so something like that.
function populateCurrentPrice(price) {
$('.currentPrice span').text(price/100);
$('#customButton span').text(price/100);
$('#currentPurchases').text( (price/100) -1);
$('#customButton').off('click');
$('#customButton').on('click', function(e) {
handler.open({
amount: price
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-->
View CPT Loop
add_filter( 'pre_get_posts', 'my_get_posts' );
function my_get_posts( $query ) {
if ( is_home() && $query->is_main_query() )
$query->set( 'post_type', array( 'Resources' ) );
return $query;
}
@avclark
avclark / wp_head cleanup
Created May 3, 2014
Cleanup unnecessary code from wp_head by adding this code to functions.php
View wp_head cleanup
<?php
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'wp_generator');
remove_action('wp_head', 'start_post_rel_link');
remove_action('wp_head', 'index_rel_link');
remove_action('wp_head', 'adjacent_posts_rel_link');
?>
@avclark
avclark / gist:10401914
Last active Aug 29, 2015
Wordpress Offset
View gist:10401914
<?php get_header(); ?>
<?php
$number_of_feature_posts = 1;
$number_of_secondary_posts = 8;
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$how_many_secondary_posts_past = ($number_of_secondary_posts * ($paged - 1));
$off = $number_of_feature_posts + (($paged > 1) ? $how_many_secondary_posts_past : 0);
?>
You can’t perform that action at this time.