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 August 29, 2015 13:58
Gravity Forms readonly fields (no JavaScript).
<?php
/**
* Read only
*
* @param string $field_content
* @param array $field
* @return string
*/
function prefix_gform_field_readonly( $field_content, $field ) {
@remcotolsma
remcotolsma / delete-wp-session-options.sql
Created June 24, 2014 07:42
Delete WP Session Manager options data
DELETE FROM wp_options WHERE option_name LIKE '_wp_session_%';
@remcotolsma
remcotolsma / cancel-subscriptions.sql
Last active August 29, 2015 14:02
Import Pronamic iDEAL subscriptions from CSV to Easy Digital Downloads
UPDATE
orbis_subscriptions
SET
cancel_date = NOW()
WHERE
cancel_date IS NULL
AND
type_id = 20
;
@remcotolsma
remcotolsma / phunit.xml
Last active August 29, 2015 14:03
PHPUnit log Coverage HTML
<?xml version="1.0" encoding="UTF-8"?>
<phpunit>
...
<logging>
<log type="coverage-html" target="build/logs/clover" charset="UTF-8" yui="true" highlight="true"/>
</logging>
...
<?php
function orbis_timesheets_init() {
// @see http://codex.wordpress.org/Function_Reference/register_taxonomy
register_taxonomy(
'orbis_timesheets_activity', // taxonomy name
null, // object type
array( // arguments
'hierarchical' => true,
'labels' => array(
<?php
function orbis_timesheets_admin_menu() {
add_menu_page(
__( 'Orbis Timesheets', 'orbis_timesheets' ),
__( 'Timesheets', 'orbis_timesheets' ),
'manage_options',
'orbis_timesheets',
'__return_false',
'dashicons-clock',
<?php
/**
* Parent file
*
* @see https://github.com/WordPress/WordPress/blob/3.9.1/wp-admin/menu-header.php#L23
* @param string $parent_file
* @return string
*/
function orbis_timesheets_parent_file( $parent_file ) {
@remcotolsma
remcotolsma / functions.php
Created June 29, 2014 12:18
Register post type with capability type.
<?php
function pronamic_custom_init() {
register_post_type( 'book', array(
'public' => true,
'label' => 'Books',
'capability_type' => 'book',
) );
}
@remcotolsma
remcotolsma / functions.php
Last active August 29, 2015 14:03
WordPress admin menu post capabilities.
<?php
function pronamic_custom_admin_menu() {
add_submenu_page(
'options-general.php',
__( 'Post Capabilities', 'pronamic' ),
__( 'Post Capabilities', 'pronamic' ),
'manage_options',
'pronamic_custom_post_capabilities',
'pronamic_custom_page_permissions'
@remcotolsma
remcotolsma / admin-page-permissions.php
Last active August 29, 2015 14:03
WordPress admin page post capabilities.
<?php
$update = filter_has_var( INPUT_POST, 'pronamic_save_permissions' );
?>
<div class="wrap">
<h2><?php echo get_admin_page_title(); ?></h2>
<form action="" method="post">