Skip to content

Instantly share code, notes, and snippets.

View tobedoit's full-sized avatar

James You tobedoit

View GitHub Profile
@tobedoit
tobedoit / gist:4146524
Created November 26, 2012 03:48
Wordpress: child page shortcode
/* Child Page with Shorcode ***********************************************************************************
** http://wp.tutsplus.com/tutorials/quick-tip-display-excerpts-of-child-pages-with-a-shortcode/ ***************
** http://botcrawl.com/how-to-change-or-remove-the-howdy-greeting-message-on-the-wordpress-user-menu-bar/ ** */
/* !차일드 페이지 코드 ***************************************************************************************** */
function subpage_peek() {
global $post;
//query subpages
$args = array(
'post_parent' => $post->ID,
'order' => 'ASC',
@tobedoit
tobedoit / gist:4146854
Created November 26, 2012 06:34
Wordpress: remove 'website' field from comment form
/* Remove 'website' field for comment form *****************************************************************
** http://techhacking.com/2011/02/04/wordpress-how-to-remove-the-website-field-from-the-comment-form/ ** **/
/* !댓글폼에서 웹싸이트 필드 제거 ***************************************************************************** */
add_filter('comment_form_default_fields', 'url_filtered');
function url_filtered($fields) {
if(isset($fields['url']))
unset($fields['url']);
return $fields;
}
@tobedoit
tobedoit / gist:4146871
Created November 26, 2012 06:36
Wordpress: Login Dashboard Modification
/* *************************************************************************************
** Dashboard Modification *********************************************************** */
/* !로그인/회원가입 대시보드 수정 ******************************************************* */
/* to change the logo */
function my_login_logo() { ?>
<style type="text/css">
body.login { background-color: #f9f9f9; height: auto !important; }
body.login div#login { padding-top: 55px !important; }
body.login div#login h1 { position: relative; }
@tobedoit
tobedoit / gist:4146874
Created November 26, 2012 06:38
Wordpress: admin page favicon
/* Admin Page Fivicon ******************************************************************************
** http://wp.tutsplus.com/tutorials/creative-coding/using-conditional-tags-to-supercharge-your-blog/
** 관리자 페이지 파비콘 적용 ************************************************************************* */
function admin_favicon() {
if(is_admin()) {
echo '<link rel="shortcut icon" href="'.get_bloginfo('url').'/favicon.png" />';
}
}
add_action('admin_head','admin_favicon');
@tobedoit
tobedoit / gist:4146876
Created November 26, 2012 06:39
Wordpress: google map shortcode
/* ********************************************************************************************************
** Google Maps Shortcode ******************************************************************************* */
/* !구글맵 shortcode ************************************************************************************ */
function fn_googleMaps($atts, $content = null) {
extract(shortcode_atts(array(
"width" => '598',
"height" => '420',
"src" => ''
), $atts));
return '<iframe width="'.$width.'" height="'.$height.'" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'.$src.'&amp;output=embed"></iframe>';
@tobedoit
tobedoit / gist:4146888
Created November 26, 2012 06:43
Wordpress: Set display name with 'first name'
/* Sets the user's display name (always) to first name last name, when it's available **************************************
** http://stackoverflow.com/questions/9326315/wordpress-change-default-display-name-publicy-as-for-all-existing-users *** */
/* !아이디 대신 이름으로 나타내기 ********************************************************************************************* */
/* Sets the user's display name (always) to first name last name, when it's avail. */
add_action ('admin_head','make_display_name_f_name_last_name');
function make_display_name_f_name_last_name(){
$users = get_users(array('fields'=>'all'));
foreach($users as $user){
$user = get_userdata($user->ID);
$display_name = $user->first_name;
@tobedoit
tobedoit / gist:4146899
Created November 26, 2012 06:45
Wordpress: disable admin bar from subscriber
/* Disable Admin Bar for all users *****************************************************************
** http://www.onextrapixel.com/2012/02/24/taking-control-of-wordpress-3-0-admin-bar/ ************ */
/* !일반회원 어드민 바 제거 ************************************************************************** */
if ( current_user_can('subscriber') ) {
show_admin_bar(false);
}
@tobedoit
tobedoit / gist:4146911
Created November 26, 2012 06:48
Wordpress: breadcrumb for pages
/* breadcrumb function for pages *************************************************************
** http://rainmakerwebdesign.com/uncategorized/wordpress-breadcrumb-function-for-pages/ *** */
/* !부모 페이지 표시 ************************************************************************* */
function rm_bread_crumbs() {
global $post;
//if the page has a parent add title and link of parent
if($post->post_parent) {
$crumbs = '<a href="'.get_permalink($post->post_parent).'">'.get_the_title($post->post_parent).'</a>'.'<span class="raquo">&raquo;</span> ';
}
$crumbs .= get_the_title($post->ID);
@tobedoit
tobedoit / gist:4146927
Created November 26, 2012 06:54
Wordpress: customize toolbar
/* Customize Toolbar **************************************************************************
** http://www.sitepoint.com/change-wordpress-33-toolbar/ *********************************** */
/* !어드민 툴바 커스트마이징 ******************************************************************** */
add_action('admin_bar_menu', 'change_toolbar', 999);
function change_toolbar($wp_toolbar) {
/* 로고 제거 */
$wp_toolbar->remove_node('wp-logo');
/* 미디어 업로드 제거 */
$wp_toolbar->remove_node('new-media');
/* change 'Howdy,' */
@tobedoit
tobedoit / gist:4146942
Created November 26, 2012 06:59
Wordpress: remove the "Dashboard" and redirect for non-admin user
/* Remove the "Dashboard" from the admin menu for non-admin users **********************************
** http://wordpress.stackexchange.com/questions/52752/hide-dashboard-from-non-admin-users ******* */
/* !관리자 아닌 회원 알림판 제거 & 리다이렉트 *********************************************************** */
function custom_remove_dashboard () {
global $current_user, $menu, $submenu;
get_currentuserinfo();
if( ! in_array( 'administrator', $current_user->roles ) ) {
reset( $menu );
$page = key( $menu );