Skip to content

Instantly share code, notes, and snippets.

View Hansanghyeon's full-sized avatar
🎯

999 Hansanghyeon

🎯
View GitHub Profile
@Hansanghyeon
Hansanghyeon / functions.php
Last active February 17, 2020 03:11
[wp-admin] 어드민페이지 custom css 가져오기
<?php
// Update CSS within in Admin
function admin_style() {
// 변수
$CDN = '';
$Static = 'https://static4log.s3.ap-northeast-2.amazonaws.com/4log';
wp_enqueue_style('WP_list_table', $Static.'/css/admin_dashborad.css');
wp_register_script( 'my_script', $Static.'/js/copy_btn.js', array('jquery'), '1.0.0', true);
wp_register_style( 'FontAwesome', 'https://use.fontawesome.com/releases/v5.6.3/css/all.css', false );
@Hansanghyeon
Hansanghyeon / functions.php
Last active February 17, 2020 03:11
[wp-admin] 어드민페이지 <body> classList.add
<?php
function my_admin_body_class( $classes ) {
return "$classes dan_admin_dashborad";
// Or: return "$classes my_class_1 my_class_2 my_class_3";
}
add_filter( 'admin_body_class', 'my_admin_body_class' );
@Hansanghyeon
Hansanghyeon / functions.php
Last active February 17, 2020 03:09
[wp] 초기 functions 셋팅 script, style, CDN
<?php
function themeslug_enqueue() {
// 변수
$CDN = 'https://cdnjs.cloudflare.com/ajax/libs';
$Static = 'https://static4log.s3.ap-northeast-2.amazonaws.com/4log';
$current_user = new WP_User(get_current_user_id());
$user_role = array_shift($current_user->roles);
// CDN
// ------------------
@Hansanghyeon
Hansanghyeon / functions.php
Last active February 17, 2020 03:11
[wp] 페이지 슬러그를 <body> classList.add
<?php
// Add page slug as a body class
function add_slug_body_class( $classes ) {
global $post;
if ( isset( $post ) ) {
$classes[] = $post->post_type . '-' . $post->post_name;
}
return $classes;
}
add_filter( 'body_class', 'add_slug_body_class' );
@Hansanghyeon
Hansanghyeon / _respondTo.scss
Last active December 22, 2020 08:49
[scss] media-query 함수
// Responsive Web Design
$breakpoints: (
"sm": (
min-width: 576px
),
"md": (
min-width: 768px
),
"lg": (
min-width: 992px
@Hansanghyeon
Hansanghyeon / functions.php
Last active January 4, 2021 04:06
[wp] child-theme
<?php
@Hansanghyeon
Hansanghyeon / template.php
Last active January 4, 2021 08:04
[wp] page template
<?php
/**
* Template Name: template
* Template Post Type: page, post
*/
get_header();
get_footer();
@Hansanghyeon
Hansanghyeon / functions.php
Created March 11, 2020 03:18
[PHP] Replace string form PHP include file
<?php
function callback($buffer)
{
return (str_replace("foo", "cool", $buffer));
}
ob_start("callback");
include 'foo.php';
ob_end_flush();
@Hansanghyeon
Hansanghyeon / Grid.ts
Last active July 19, 2020 05:40
[TS] styled-component media query helper functions
export const breakpoints: {
hg: 1440,
xl: 1200,
lg: 992,
md: 768,
sm: 576,
xs: 575,
} as const;
const Grid = {
@Hansanghyeon
Hansanghyeon / script.sh
Created March 17, 2020 08:01
[shell] How to set the fish shell as the default shell
echo "/usr/local/bin/fish" | sudo tee -a /etc/shells
chsh -s `which fish`