Skip to content

Instantly share code, notes, and snippets.

View mandiwise's full-sized avatar

Mandi Wise mandiwise

  • Edmonton, Canada
View GitHub Profile
@crondeau
crondeau / chilpages-looping.php
Last active April 25, 2022 05:26
I used this code to loop through child pages of a custom post type called work. Each Work piece had a title, featured image and pdf. The child pages, describe the details of the project or work piece and display as an accordion. So basically what we have is an accordion within an accordion.
<?php
// loop through the sub-pages of your custom post type
$childpages = new WP_Query( array(
'post_type' => 'work',
'post_parent' => $this_page,
'posts_per_page' => 100,
'orderby' => 'menu_order'
));
while ( $childpages->have_posts() ) : $childpages->the_post(); ?>
<?php
/*
* Usage for a custom post type named 'movies':
* unregister_post_type( 'movies' );
*
* Usage for the built in 'post' post type:
* unregister_post_type( 'post', 'edit.php' );
*/
function unregister_post_type( $post_type, $slug = '' ){
@tommcfarlin
tommcfarlin / add-custom-post-type-menu.php
Created April 25, 2013 12:38
[WordPress] Add a custom post type menu as a child of an existing custom post type menu.
<?php
// Define the 'Portfolio' post type. This is used to represent galleries
// of photos. This will be our top-level custom post type menu
$args = array(
'labels' => array(
'all_items' => 'Gallery',
'menu_name' => 'Portfolio',
'singular_name' => 'Gallery',
'edit_item' => 'Edit Gallery',
@annalinneajohansson
annalinneajohansson / order_by_multiple_meta_values.php
Last active January 17, 2018 14:40
Solution to order posts by two different meta values (the same way ORDER val1, val2 would with SQL) http://wordpress.stackexchange.com/a/67391/5045
<?php
/*
* Solution to order first by date, then by start time (both are meta values)
* http://wordpress.stackexchange.com/a/67391/5045
* */
add_action( 'pre_get_posts', 'pre_get_posts_programpunkter' );
function pre_get_posts_programpunkter( $query ) {
if( !is_admin() && is_post_type_archive( 'programpunkt' ) && $query->is_main_query() ) {
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active May 2, 2024 05:55
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@kasparsd
kasparsd / wordpress-plugin-svn-to-git.md
Last active April 17, 2024 12:35
Using Git with Subversion Mirroring for WordPress Plugin Development
@spivurno
spivurno / gist:3710653
Created September 12, 2012 23:07
Gravity Wiz // Limit IP to One Submission Per Time Period
<?php
/**
* Limit IP to One Submission Per Time Period
* http://gravitywiz.com/2012/05/12/limit-ip-to-one-submission-per-time-period
*/
$gws_limit_message = 'You may only submit this form once every 24 hours.';
$gws_limit_time = 86400; // must be specified in seconds; 86400 seconds is equal to 24 hours
@spivurno
spivurno / gw-gravity-forms-random-field-order.php
Last active November 26, 2020 13:10
Gravity Wiz // Gravity Forms // Random Field Order
<?php
/**
* WARNING! THIS SNIPPET MAY BE OUTDATED.
* The latest version of this snippet can be found in the Gravity Wiz Snippet Library:
* https://github.com/gravitywiz/snippet-library/blob/master/gravity-forms/gw-random-fields.php
*/
/**
* Gravity Wiz // Gravity Forms // Random Fields
*
* Randomly display a specified number of fields on your form.
@niallo
niallo / gist:3109252
Created July 14, 2012 04:54
Parse Github `Links` header in JavaScript
/*
* parse_link_header()
*
* Parse the Github Link HTTP header used for pageination
* http://developer.github.com/v3/#pagination
*/
function parse_link_header(header) {
if (header.length == 0) {
throw new Error("input must not be of zero length");
}
@nachiket-p
nachiket-p / meteor_servercall.html
Created June 21, 2012 07:41
Meteor: Calling server method from client
<head>
<title>meteor_servercall</title>
</head>
<body>
{{> simple}}
{{> passData}}
</body>
<template name="simple">