Skip to content

Instantly share code, notes, and snippets.

View nusserstudios's full-sized avatar

Nusser Studios nusserstudios

View GitHub Profile
<?php
/**
* Foundation 5 Top Bar Menu Walker Class for WordPress 3.9+
*/
class Foundation_Walker extends Walker_Nav_Menu
{
function display_element( $element, &$children_elements, $max_depth, $depth=0, $args, &$output )
{
$element->has_children = !empty( $children_elements[$element->ID] );
@nusserstudios
nusserstudios / Composer ACF
Last active March 12, 2016 16:31
Advanced Custom Fields PRO for Composer
{
"repositories": [
{
"type": "package",
"package": {
"name": "advanced-custom-fields/advanced-custom-fields-pro",
"version": "5.0",
"type": "wordpress-plugin",
"dist": {
"type": "zip",
ssh-keygen -E md5 -lf ~/.ssh/id_rsa.pub
@nusserstudios
nusserstudios / Contract Killer 3.md
Created March 31, 2016 12:44
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

@nusserstudios
nusserstudios / Functions
Last active June 25, 2018 07:26
Zurb Foundation Pagination Function for WordPress
<?php
function foundation_pagination($before = '', $after = '') {
global $wpdb, $wp_query;
$request = $wp_query->request;
$posts_per_page = intval(get_query_var('posts_per_page'));
$paged = intval(get_query_var('paged'));
$numposts = $wp_query->found_posts;
$max_page = $wp_query->max_num_pages;
if ( $numposts <= $posts_per_page ) { return; }
if(empty($paged) || $paged == 0) {
/*
* Profile Builder Edit Profile Link in single-userlisting visible only for users with the edit_users permission
* Usage: [pb-edit-profile-link link="http://www.example.com/edit-profile" title="User Profile"]
*/
add_shortcode('pb-edit-profile-link', 'func_pb_edit_profile_link');
function func_pb_edit_profile_link( $atts ){
if ( !isset( $atts['link'] ) || !isset( $atts['title'])){
return '';
}
@nusserstudios
nusserstudios / header.php
Created July 21, 2016 04:25 — forked from retlehs/header.php
Sage header template for Bootstrap top navbar component
<?php
// This file assumes that you have included the nav walker from https://github.com/twittem/wp-bootstrap-navwalker
// somewhere in your theme.
?>
<header class="banner navbar navbar-default navbar-static-top" role="banner">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only"><?= __('Toggle navigation', 'sage'); ?></span>
@nusserstudios
nusserstudios / gist:07703f6fcc2b0714d39876bad2b3512a
Created April 5, 2018 13:12
WordPress Conditional Category
<?php if ( in_category('CategoryName') ) { ?>
Content goes here
<?php } else { ?>
Other content goes here (or nothing)
<?php } ?>
@nusserstudios
nusserstudios / gist:3886ca5148bcde213ecec6cc3f72919e
Created April 5, 2018 13:19
Yoast SEO Breadcrumbs with Foundation Markup
<?php if ( function_exists('yoast_breadcrumb') ) { yoast_breadcrumb('<ul class="breadcrumbs">'.'<li>','</li>'.'</ul>'); } ?>
@nusserstudios
nusserstudios / gist:bb579da699a114433f67b0a25cd59618
Last active April 5, 2018 13:23
WP Conditional Loop within WP Loop
<?php query_posts( 'category_name=NAME&posts_per_page=-1' ); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<a href="<?php echo get_permalink( $id ); ?>">
<?php the_title(); ?>
</a>
<?php the_excerpt(); ?>
<?php endwhile; else : ?>
<?php esc_html_e( 'CUSTOM ERROR MESSAGE HERE.' ); ?>
<?php endif; ?>