Skip to content

Instantly share code, notes, and snippets.

Richard Barratt richerimage

Block or report user

Report or block richerimage

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View pretty_dumps.php
$dump = what_I_want_to_dump();
print("<pre>".print_r($dump,true)."</pre>");
View facet-test.php
<?php
add_action( 'wp_head', 'cvl_add_facetwp_fwp_http', 100 );
function cvl_add_facetwp_fwp_http() {
if (is_singular('job_listing')) {
global $post; ?>
@richerimage
richerimage / cvl-facetwp.php
Last active Nov 26, 2018
cvl-facet-functions.php
View cvl-facetwp.php
<?php
add_filter( 'facetwp_query_args', function( $query_args, $class ) {
$parent = get_the_ID();
if ( 'example' == $class->ajax_params['template'] ) {
$query_args['post_parent'] = $parent;
$query_args['post_type'] = 'job_application';
$query_args['post_status'] = 'published';
@richerimage
richerimage / wp_query.php
Last active Nov 19, 2018
WP Query Magic
View wp_query.php
<?php
$args = array(
// Arguments for your query.
);
// Custom query.
$query = new WP_Query( $args );
View redirect-all-users-except-admins-on-login.php
add_filter('login_redirect', 'admin_login_redirect', 10, 3);
function admin_login_redirect( $redirect_to, $request, $user ) {
global $user;
if( isset( $user->roles ) && is_array( $user->roles ) ) {
if( in_array( 'administrator', $user->roles ) ) {
@richerimage
richerimage / Gravity Form - Display list of Users as a dropdown.php
Created May 14, 2018
Gravity Form - Display list of Users as a dropdown (User ID is the value)
View Gravity Form - Display list of Users as a dropdown.php
add_filter( 'gform_pre_render_FORM_ID', 'dna_user_list_dropdown' );
add_filter( 'gform_pre_validation_FORM_ID', 'dna_user_list_dropdown' );
add_filter( 'gform_pre_submission_filter_FORM_ID', 'dna_user_list_dropdown' );
add_filter( 'gform_admin_pre_render_FORM_ID', 'dna_user_list_dropdown' );
function dna_user_list_dropdown( $form ) {
foreach ( $form['fields'] as &$field ) {
@richerimage
richerimage / wp_disable_admin_bar.php
Created Jan 22, 2018
Disable Wordpress Admin Bar
View wp_disable_admin_bar.php
/*
* Source
* https://code.tutsplus.com/articles/how-to-disable-the-admin-bar-in-wordpress-33--wp-23361
*/
if (!function_exists('disableAdminBar')) {
function disableAdminBar(){
View css-for-all-except-last-child.css
.selector:not(:last-child) {
/* styles for everything except last item */
}
@richerimage
richerimage / supress_metabox_display.php
Created Jul 11, 2016
CHANGE THE DEFAULTS WITH THE DEFAULT_HIDDEN_META_BOXES HOOK
View supress_metabox_display.php
<?php
/**
* vpm_default_hidden_meta_boxes
* Source: https://www.vanpattenmedia.com/2014/code-snippet-hide-post-meta-boxes-wordpress
*/
function vpm_default_hidden_meta_boxes( $hidden, $screen ) {
// Grab the current post type
$post_type = $screen->post_type;
// If we're on a 'post'...
if ( $post_type == 'post' ) {
View Get Content from Post ID.php
$post_id = 7;
echo apply_filters('the_content', get_post_field('post_title', $post_id));
echo get_post_field('post_content', $post_id));
echo get_post_meta($post_id, 'thesis_thumb_height', true);
You can’t perform that action at this time.