Skip to content

Instantly share code, notes, and snippets.

Richard Archambault richardmtl

Block or report user

Report or block richardmtl

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
@richardmtl
richardmtl / redirect.php
Created Dec 5, 2019
Redirect after a resume is submitted
View redirect.php
add_action( 'resume_manager_resume_submitted', 'wpjmres_final_redirect', 99);
function wpjmres_final_redirect(){
wp_redirect('https://DOMAIN.COM');
exit();
}
@richardmtl
richardmtl / gist:1b3e78f7e9bc26942888271b4cd2c49e
Created Mar 27, 2019
limit WPJM Applications allowed file types (untested)
View gist:1b3e78f7e9bc26942888271b4cd2c49e
function restrict_wpjm_applications_mime_types( $allowed_mime_types, $field) {
if ( $field['label'] == 'My Field' ) {
unset( $allowed_mime_types['png'] );
$allowed_mime_types['json'] = 'application/json';
}
return $allowed_mime_types;
}
add_filter( 'job_manager_mime_types', 'restrict_wpjm_applications_mime_types' );
@richardmtl
richardmtl / wpcomfollow-allposts.php
Last active Nov 3, 2017
Adding WordPress.com Follow button to all posts
View wpcomfollow-allposts.php
add_filter ('the_content', 'insertWPcomFollowerButton');
function insertWPcomFollowerButton($content) {
if(is_single()) {
$content.= '<a class="wordpress-follow-button" href="http://exoticmysticism.com" data-blog="http://exoticmysticism.com" data-lang="en">Follow Lisa Joy on WordPress.com</a>';
$content.= '<script type="text/javascript">(function(d){var f = d.getElementsByTagName('SCRIPT')[0], p = d.createElement('SCRIPT');p.type = 'text/javascript';p.async = true;p.src = '//widgets.wp.com/platform.js';f.parentNode.insertBefore(p,f);}(document));</script>';
}
return $content;
}
@richardmtl
richardmtl / css_resources.md
Last active Aug 29, 2015 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.
View css_resources.md

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@richardmtl
richardmtl / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@richardmtl
richardmtl / jp_restrict_rp.php
Created Aug 4, 2014
Restrict Jetpack's Related Posts to a specific time-frame
View jp_restrict_rp.php
function jetpackme_related_posts_date_restricted( $date_range, $post_id ) {
// We can change this based on $post_id too but let's just filter everything
$date_range = array(
'from' => strtotime( '1 January 2013' ),
'to' => time(),
);
return $date_range;
}
add_filter( 'jetpack_relatedposts_filter_date_range', 'jetpackme_related_posts_date_restricted' );
View test-plugin.php
<?php
/*
* Plugin Name: AA Test Plugin
* Plugin URI: http://wordpress.org/extend/plugins/test
* Description: Testing all kinds of things!
* Author: Richard Archambault
* Version: 1.0
* License: GPL2+
*/
@richardmtl
richardmtl / Remove JP Stats from Homepage
Created Jul 15, 2014
Remove Jetpack Stats from homepage only
View Remove JP Stats from Homepage
add_action( 'init', 'jp_remove_stats');
add_action( 'template_redirect', 'jp_maybe_add_tracking_code', 1);
function jp_remove_stats(){
remove_action( 'template_redirect', 'stats_template_redirect', 1 );
}
function jp_maybe_add_tracking_code(){
if( !is_home() ){
stats_template_redirect();
}
}
@richardmtl
richardmtl / functions.php
Created Jan 31, 2014 — forked from kraftbj/functions.php
Make homepage og:image be an image from the latest post
View functions.php
<?php
function fb_home_image( $tags ) {
if ( is_home() ) {
$latest_post = get_posts("post_type=post&numberposts=1");
$latest_post = $latest_cpt[0]->ID;
if ( class_exists( 'Jetpack_PostImages' ) ) {
$post_images = Jetpack_PostImages::get_images( $latest_post, array( 'width' => 200, 'height' => 200 ) );
if ( $post_images && !is_wp_error( $post_images ) ) {
$image = array();
View gist:8060045
if ( ! empty( $title ) ) :
echo $before_title;
echo esc_html( $title );
echo $after_title
endif;
You can’t perform that action at this time.