Skip to content

Instantly share code, notes, and snippets.

View sp4r74cus's full-sized avatar

Yaniv Harush sp4r74cus

  • Amsterdam, The Netherlands
View GitHub Profile
@sp4r74cus
sp4r74cus / keybase.md
Last active September 12, 2019 07:30

Keybase proof

I hereby claim:

  • I am sp4r74cus on github.
  • I am sp4r74cus (https://keybase.io/sp4r74cus) on keybase.
  • I have a public key ASBPWltqg40EIneWbecm2GAXJKFvKNvkGE95Y_MceGVzGgo

To claim this, I am signing this object:

@sp4r74cus
sp4r74cus / Republish WordPress Old Posts using WP-CLI
Last active August 22, 2018 09:40
Query for old posts and update their date fields. Requires the wp-cli-restful package (https://wp-cli.org/restful/).
# Linux
wp post update $(wp rest post list --before="`date -u +%Y-%m-%dT%H:%M:%SZ -d "1 year ago"`" \
--format=ids --per_page=1) --post_date="`date '+%Y-%m-%d %H:%M:%S'`" --post_date_gmt="`date -u '+%Y-%m-%d %H:%M:%S'`" \
--post_modified="`date '+%Y-%m-%d %H:%M:%S'`" --post_modified_gmt="`date -u '+%Y-%m-%d %H:%M:%S'`"
# Mac OSX
wp post update $(wp rest post list --before="`date -v -1y +%Y-%m-%dT%H:%M:%SZ`" \
--format=ids --per_page=1) --post_date="`date '+%Y-%m-%d %H:%M:%S'`" --post_date_gmt="`date -u '+%Y-%m-%d %H:%M:%S'`" \
--post_modified="`date '+%Y-%m-%d %H:%M:%S'`" --post_modified_gmt="`date -u '+%Y-%m-%d %H:%M:%S'`"
@sp4r74cus
sp4r74cus / wp-login-logo.php
Last active November 30, 2017 11:58
Change WordPress Logo in Login Page
// change login page logo image
function my_login_head() {
?>
<style>
body.login #login h1 a {
background: url(<?= get_bloginfo('template_url'); ?>/images/logo.png) no-repeat scroll center top transparent;
height: 60px;
width: 330px;
}
</style>
@sp4r74cus
sp4r74cus / gist:1565832
Created January 5, 2012 15:55
Redirect to the post page if category have only one post
<?php
/*
* Redirect to the post page if category have only one post
* ---------------------------------------------------------
*
*/
function yh_redirect_to_post() {