Skip to content

Instantly share code, notes, and snippets.

View luclemo's full-sized avatar

Lucas Lemonnier luclemo

  • Ste-Justine Hospital Research Center
  • Montreal, QC
View GitHub Profile
@luclemo
luclemo / custom-menu-items.php
Last active June 3, 2016 12:39 — forked from frankiejarrett/gist:5224398
Remove menu items from the WP dashboard (ex: remove posts & comments if client doesn't blog) #wordpress
<?php
/**
* Restricts certain menu items from appearing the WP Admin area. Does not
* affect Administrator users.
*
* @action admin_menu
*/
function fjarrett_restrict_admin_menu_items() {
// Don't restrict Administrator users.
@luclemo
luclemo / remove-toolbar.php
Last active June 3, 2016 12:38 — forked from JiveDig/remove_toolbar.php
#wordpress
<?php
//* Remove toolbar from frontend and remove CSS that bumps content down
add_filter( 'show_admin_bar', 'bhl_hide_admin_bar_from_front_end' );
function bhl_hide_admin_bar_from_front_end(){
if ( ! current_user_can('manage_options') ) {
return false;
// Remove CSS
remove_action( 'wp_head', '_admin_bar_bump_cb' );
@luclemo
luclemo / gravity-forms-date-timestamp.php
Last active February 25, 2017 19:24 — forked from spivurno/gist:5065194
Use Gravity Forms Conditional Logic with Dates #wordpress #gravityForms
<?php
/**
* Use Gravity Forms Conditional Logic with Dates
* http://gravitywiz.com/use-gravity-forms-conditional-logic-with-dates/
*/
add_filter("gform_field_value_timestamp", "gwiz_populate_timestamp");
function gwiz_populate_timestamp( $value ){
return time();
}
@luclemo
luclemo / disable-comments.php
Last active October 17, 2018 14:44 — forked from alexwoollam/function.php
Wordpress Disable Comments (add to function.php)
<?php
/**
* Disables comments, Add below to existing function.php file.
*/
/** Disable support for comments and trackbacks in post types. */
function df_disable_comments_post_types_support() {
$post_types = get_post_types();
foreach ( $post_types as $post_type ) {
if ( post_type_supports( $post_type, 'comments' ) ) {
@luclemo
luclemo / emailbot_ssc.php
Last active October 22, 2018 19:13 — forked from norcross/emailbot_ssc.php
Obfuscate email shortcode #wordpress
/*
Usage (on the HTML tab, not the visual editor)
[email address="[email protected]"]
*/
function emailbot_ssc($attr) {
extract( shortcode_atts( array(
'address' => '',
), $attr ) );