Skip to content

Instantly share code, notes, and snippets.

View damianc's full-sized avatar
👍
datz oke

Damian damianc

👍
datz oke
View GitHub Profile
@damianc
damianc / function.php
Created May 7, 2018 09:50
[WordPress] Exclude posts with an assigned category from author's page
<?php
add_action('pre_get_posts', function ($query) {
if (is_author()) {
$term = get_term_by('name', 'CATEGORY NAME', 'category');
$query->set('cat', $term->term_id;);
}
});
?>
@damianc
damianc / functions.php
Created July 12, 2018 10:22
Change a logo in the login form
// ...
add_action('login_enqueue_scripts', function () {
?>
<style type="text/css">
#login h1 a, .login h1 a {
background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/images/site-login-logo.png);
height:65px;
width:320px;
background-size: 320px 65px;
background-repeat: no-repeat;
@damianc
damianc / style-reader.js
Created July 14, 2019 21:50
FileReader of Data URL
var css = `
body {
background-color: #fa0;
}
`;
var sheet = new File([css], 'style.css', {type: 'text/css'});
var styleReader = new FileReader();
styleReader.onload = function (e) {
@damianc
damianc / counter.js
Last active July 15, 2019 13:20
React-like micro-lib [v.0.0.1]
import Component from './reactive';
export default class Counter extends Component {
constructor() {
super();
this.state = {counter: 0};
}
render() {
this.__root && document.body.removeChild(this.__root);
let counterBox = document.createElement('div');