Skip to content

Instantly share code, notes, and snippets.

View remcotolsma's full-sized avatar
🏢
Working @pronamic

Remco Tolsma remcotolsma

🏢
Working @pronamic
View GitHub Profile
@remcotolsma
remcotolsma / functions.php
Last active September 13, 2015 13:07
WordPress register_post_type() project with archive and rewite slug.
<?php
function prefix_init() {
register_post_type( 'project', array(
'public' => true,
'label' => __( 'Projects', 'text_domain' ),
'has_archive' => true,
'rewrite' => array( 'slug' => _x( 'projects', 'slug', 'text_domain' ) ),
) );
}
@remcotolsma
remcotolsma / header.php
Created September 13, 2015 13:13
WordPress page header image on custom post type archive template.
<?php
if ( is_post_type_archive() ) {
$object = get_queried_object();
if ( isset( $object->rewrite ) && is_array( $object->rewrite ) && isset( $object->rewrite['slug'] ) ) {
$slug = $object->rewrite['slug'];
$page = get_page_by_path( $slug );
@remcotolsma
remcotolsma / plugin.php
Last active September 30, 2015 18:49
WordPress sponsors plugin with custom featured image meta box for banners.
<?php
class PronamicSponsorsPlugin {
/**
* Constructs and initalizes an sponsor plugin
*
* @param string $file
*/
public function __construct( $file ) {
$this->file = $file;
@remcotolsma
remcotolsma / admin.js
Created September 30, 2015 18:49
WordPress sponsors plugin with custom featured image meta box for banners.
jQuery( document ).ready( function( $ ) {
// Image
// @see https://github.com/WordPress/WordPress/blob/4.1/wp-includes/js/media-editor.js#L721-L739
$( '.pronamic-image-control' ).on( 'click', '.set-post-image', function( event ) {
event.preventDefault();
var $imageControl = $( event.delegateTarget );
var config = $imageControl.data( 'image-control' );
@remcotolsma
remcotolsma / readme.md
Last active October 2, 2015 09:42
Easy Digital Downloads - Software Licenses

Easy Digital Downloads - Software Licenses

Post Type Payment

post_type = edd_payment

Meta Keys

_edd_sl_is_renewal = Flag to indicate an renewal.
_edd_sl_renewal_key = The renewal key.

@remcotolsma
remcotolsma / infinitewp-multiuser-bug.md
Last active October 6, 2015 09:51
InfiniteWP multiUser bug

InfiniteWP multiUser bug

index.php

...

$mainJson = json_encode(panelRequestManager::getSitesUpdates());

...
@remcotolsma
remcotolsma / READMEmd
Last active October 26, 2015 15:19
jQuery UI Droppable in iframe element
# jQuery UI Droppable in iframe element
* http://jqueryui.com/draggable/
* http://jqueryui.com/droppable/
* http://stackoverflow.com/a/12171319
@remcotolsma
remcotolsma / README.md
Created October 30, 2015 19:12
Select2 no results create new one
@remcotolsma
remcotolsma / nginx-home.conf
Last active November 12, 2015 14:08
nginx.conf
server {
listen 80;
server_name *.dev;
root /Users/remco/Websites/$host/;
access_log /usr/local/etc/nginx/logs/default.access.log main;
location / {
include /Users/remco/Websites/php-fpm.conf;
@remcotolsma
remcotolsma / functions.php
Last active November 16, 2015 13:18
WordPress theme class example
<?php
class AseTheme {
public function __construct() {
add_action( 'after_setup_theme', array( $this, 'after_setup_theme' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
// ...
}