Skip to content

Instantly share code, notes, and snippets.

Tobias Schutter tobiasschutter

View GitHub Profile
@tobiasschutter
tobiasschutter / acp_get_layouts_by_post_type.php
Last active Jul 26, 2019
Admin Columns Pro API method for fetching layouts by post type
View acp_get_layouts_by_post_type.php
<?php
/**
* @param string $post_type
*
* @return \ACP\Layout[]
*/
function acp_get_layouts_by_post_type( string $post_type ) : array {
$list_screen = new \ACP\ListScreen\Post( $post_type );
$layouts = new \ACP\Layouts( $list_screen );
@tobiasschutter
tobiasschutter / acp_get_columns_by_post_type.php
Last active Jul 26, 2019
Admin Colums Pro API method for fetching columns by post type
View acp_get_columns_by_post_type.php
<?php
/**
* @param string $post_type
* @param string|null $layout
*
* @return \AC\Column[]
*/
function acp_get_columns_by_post_type( string $post_type, string $layout = null ): array {
$list_screen = new \ACP\ListScreen\Post( $post_type );
@tobiasschutter
tobiasschutter / class-mla-admin-columns-support.php
Last active Jan 25, 2018
class-mla-admin-columns-support.php for ACP 4.2
View class-mla-admin-columns-support.php
<?php
/**
* Media Library Assistant Admin Columns (plugin) Support
*
* @package Media Library Assistant
* @since 2.50
*/
defined( 'ABSPATH' ) or die();
if ( class_exists( 'ACP_Editing_Strategy' ) ) {
@tobiasschutter
tobiasschutter / search_user_custom_fields.php
Last active Feb 2, 2016
Add custom fields for users to the search in the wp-admin
View search_user_custom_fields.php
<?php
/**
* Add custom fields for users to the search in the wp-admin
*/
function codepress_search_user_custom_fields( $user_query ) {
// Fill in the custom fields you want to add to the search
$custom_fields = array(
'my_custom_field_1',
'my_custom_field_2'
@tobiasschutter
tobiasschutter / search_post_custom_fields.php
Last active Feb 3, 2016
Add custom fields for posts to the search in the wp-admin
View search_post_custom_fields.php
<?php
/**
* Add custom fields for users to the search in the wp-admin
*/
function codepress_search_post_custom_fields( $wp ) {
global $pagenow, $wpdb;
// Fill in the post types that should be used
$post_types = array(
'post',
@tobiasschutter
tobiasschutter / send-mail-with-mandrill-template.php
Last active Apr 23, 2020
send-mail-with-mandrill-template
View send-mail-with-mandrill-template.php
<?php
/**
* Send Mail through Mandrill with Template
*
* See https://mandrillapp.com/api/docs/index.php.html
*
* @param string $to_email Email Reciever
* @param string $to_name Name Receiver
* @param string $subject Mail subject
* @param string $message HTML message ( allowed ul, p, h1 )
@tobiasschutter
tobiasschutter / maintenance.html
Last active May 8, 2017
Simple Maintenance Page
View maintenance.html
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
View list-all-wp-hooks.php
<?php
// source: http://www.wprecipes.com/list-all-hooked-wordpress-functions
function list_hooked_functions($tag=false){
global $wp_filter;
if ($tag) {
$hook[$tag]=$wp_filter[$tag];
if (!is_array($hook[$tag])) {
trigger_error("Nothing found for '$tag' hook", E_USER_WARNING);
return;
}
You can’t perform that action at this time.