Skip to content

Instantly share code, notes, and snippets.

@takien
takien / custom-login-logo.php
Created June 3, 2023 01:28
WordPress custom login Logo
<?php
function custom_loginlogo() {
echo '<style type="text/css">
.login h1 a {background-image: url('.wp_get_attachment_image_src( get_theme_mod( 'custom_logo' ), 'large', false )[0]
.') !important;
pointer-events: none;
background-size: contain;
height: 100px;
font-size: inherit;
width: auto;
@takien
takien / gist:7339632
Last active December 21, 2017 10:53
WordPress Custom Paging
<?php
$perpage = 12;
$arg = Array(
'posts_per_page'=> $perpage,
'post_type'=>'product',
'paged'=> $paged
);
$query = new WP_Query($arg);
$numrows = $query->found_posts;
if($query->have_posts())
@takien
takien / file1.txt
Created October 10, 2013 17:36
test desc
test file 1
@takien
takien / related-tag.php
Created May 9, 2013 04:24
WordPress related post by tag
@takien
takien / lowsrc.js
Created December 24, 2012 17:07
Alternate to lowsrc. usage: <img src="lowres.jpg" data-src="highres.jpg" />
/**
* Laod large image at last.
* requires jQuery
* @author: takien
*/
jQuery(document).ready(function($){
$('img').each(function(){
var hires = $(this).data().src;
if((hires != undefined) && (hires != '')){
$(this).attr('src',hires);
@takien
takien / tax-order-by-latest-post.php
Created December 15, 2012 08:21
Order WordPress taxonomy (also category) by latest post.
<?php
/*
* taxonomy orderby latest post
* add new arg for taxonomy (include category),
* orderby=latest_post
* @author: takien.com
* the original version by http://jeffry.net (only for category)
*/
function filter_term_sort_by_latest_post_clauses( $pieces, $taxonomies, $args ) {
global $wpdb;
/*static.js
* @author: takien
* @link: http://takien.com
* static element uses jQuery, no CSS required.
* Usage: add class 'element-static' to your element to make it static
*/
jQuery(document).ready(function($){
function element_static(scroll){
$('.element-static').each(function() {
@takien
takien / gist:4115858
Created November 20, 2012 03:54
WordPress, Disable Featured image on Single Post
/**
* Disable Featured image on Single Post
* @version: 1.0
* @author: takien
* @url: http://takien.com
* Copy and paste this code in your theme's functions.php
*/
add_filter('post_thumbnail_html','disable_single_featured');
function disable_single_featured(){
@takien
takien / functions.php
Created November 15, 2012 14:56
WordPress Custom Rewrite Rule
/**
* WordPress Custom Rewrite Rule
* @author: takien
* @version: 1.0
* @url: http://takien.com
*/
function create_rewrite_rules() {
global $wp_rewrite;
$rewrite_tag = '%coba%';