Skip to content

Instantly share code, notes, and snippets.

View nroca's full-sized avatar

Nathan Roca nroca

  • Los Angeles, CA
View GitHub Profile
@nroca
nroca / wp_page-loop
Created May 26, 2014 15:54
Wordpress single page loop.
<?php $recent = new WP_Query("page_id=21"); while($recent->have_posts()) : $recent->the_post();?>
<!-- content -->
<?php endwhile; ?>
@nroca
nroca / wp_cpt-loop
Created May 26, 2014 16:13
Wordpress custom post type loop
<?php $cpt = new WP_Query('post_type=POSTTYPE&posts_per_page=-1');
while ($cpt->have_posts()) : $cpt->the_post();?>
<?php endwhile; wp_reset_query(); ?>
@nroca
nroca / home-block-one.php
Created May 26, 2014 16:24
ACF - Get the field
<?php the_field('page_subtitle'); ?>
@nroca
nroca / Git - Alias
Created May 26, 2014 20:05
bash_profile - Git Alias'
alias ga='git add'
alias gp='git push'
alias gl='git log'
alias gs='git status'
alias gd='git diff'
alias gdc='git diff --cached'
alias gm='git commit -m'
alias gma='git commit -am'
alias gb='git branch'
alias gc='git checkout'
# editorconfig.org
# http://css-tricks.com/changing-spaces-tabs-sublime-text/
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
@nroca
nroca / wpmp-composer.json
Created June 29, 2014 00:32
Wordpress Migrate Pro Composer JSON
{
"comment": "http://codelight.eu/using-private-wordpress-repositories-with-composer/",
"repositories": [
{
"type": "package",
"package": {
"name": "deliciousbrains/wp-migrate-db-pro",
"version": "1.3.6",
"type": "wordpress-plugin",
"dist": {
@nroca
nroca / gist:ccf6565a5d7cd48a09f4
Created July 5, 2014 23:18
hide-admin-bar-wordpress
http://davidwalsh.name/hide-admin-bar-wordpress
add_filter('show_admin_bar', '__return_false');
@nroca
nroca / ansible-bedrock provision error
Created July 18, 2014 01:20
ansible-bedrock provision error
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'roots/bedrock'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'roots/bedrock' is up to date...
==> default: Setting the name of the VM: dewstudio_default_1405646209626_28639
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
@nroca
nroca / gist:511ef1d287ba7121f596
Created October 9, 2014 05:39
ACF Options Page (Icon/Position)
// http://support.advancedcustomfields.com/forums/topic/change-menu-position-of-options-page/
acf_add_options_page( array(
'page_title' => 'Home Page Sliders',
'menu_title' => 'Sliders',
'menu_slug' => 'home-page-sliders',
'capability' => 'edit_posts',
'icon_url' => 'dashicons-images-alt2',
'position' => 7
@nroca
nroca / gist:92a1cbe217644cb5eee6
Created November 17, 2014 02:19
Show what template is being used
add_action('wp_head', 'show_template');
function show_template() {
global $template;
print_r($template);
}