Skip to content

Instantly share code, notes, and snippets.

View teolopez's full-sized avatar
🤓

Teodoro Lopez teolopez

🤓
View GitHub Profile
@teolopez
teolopez / WordPress Custom Login Function - functions.php
Last active February 26, 2016 10:43
Custom WordPress Login Form
// ------------------------------------------------------
// custom login style for theme for site url/wp-login.php
// ------------------------------------------------------
function childtheme_custom_login() {
echo '<link rel="stylesheet" type="text/css" href="' . get_bloginfo('stylesheet_directory') . '/customlogin.css" />';
}
add_action('login_head', 'childtheme_custom_login');
@teolopez
teolopez / WordPress Redirect all non-logged-in users
Last active October 5, 2018 23:52 — forked from daltonrooney/gist:1737771
Redirect all non-logged-in users to the login page (private site). Add to functions.php.
<?php
// ----------------------------------------------------------------------------------------
// Redirect all non-logged-in users to the login page (private site). Add to functions.php.
// ----------------------------------------------------------------------------------------
function admin_redirect() {
if ( !is_user_logged_in()) {
wp_redirect( home_url('/wp-admin/') );
exit;
}
@teolopez
teolopez / additional_contact_fields_wordpress
Last active December 18, 2015 23:28
Additional contact fields in WordPress, display, and saving additional contact field when registering new Wordpress user. Used bootstrap for registration form part. Add this code to your functions.php
// Add Twitter, Facebook and Google+ field to contact methods, remove AIM, YIM and Jabber
add_filter( 'user_contactmethods', 'ts_add_contact_fields' );
function ts_add_contact_fields( $contactmethods ) {
$contactmethods['linkedin'] = 'LinkedIn';
$contactmethods['twitter'] = 'Twitter';
$contactmethods['facebook'] = 'Facebook';
$contactmethods['googleplus'] = 'Google+';