Skip to content

Instantly share code, notes, and snippets.

View kharissulistiyo's full-sized avatar
🏠
Working from home

Kharis Sulistiyono kharissulistiyo

🏠
Working from home
View GitHub Profile
<style type="text/css">
.site-logo-middle-menu{
position: relative;
display: inline-block;
margin-left: 10px;
margin-right: 10px;
}
.site-logo-middle-menu > a{
position: absolute;
@kharissulistiyo
kharissulistiyo / header.php
Created August 20, 2016 17:07
Sydney logo + description
<?php if ( get_theme_mod('site_logo') ) : ?>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php bloginfo('name'); ?>"><img class="site-logo" src="<?php echo esc_url(get_theme_mod('site_logo')); ?>" alt="<?php bloginfo('name'); ?>" /></a>
<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
<?php else : ?>
@kharissulistiyo
kharissulistiyo / header.php
Created August 20, 2016 17:05
Sydney logo
<?php if ( get_theme_mod('site_logo') ) : ?>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php bloginfo('name'); ?>"><img class="site-logo" src="<?php echo esc_url(get_theme_mod('site_logo')); ?>" alt="<?php bloginfo('name'); ?>" /></a>
<?php else : ?>
@kharissulistiyo
kharissulistiyo / functions.php
Created November 27, 2015 12:36
WooCommerce: Display all products in one page in a simple way
<?php
/**
* All products in one page
*
* Display all products in a table with their add to cart button.
* Usage : [all_products] to display all products.
* Usage : [all_products category="singles"] to display products under "singles" category (slug).
*/
@kharissulistiyo
kharissulistiyo / functions.php
Created November 21, 2015 08:48
Zerif Lite WordPress Theme: Display "Continue reading" link in post archive
/**
* Zerif Lite version 1.8.2.9
*/
add_filter('get_the_excerpt', 'zerif_add_read_more_link');
function zerif_add_read_more_link($post_excerpt){
global $post;
if(strstr($post->post_content,'<!--more-->')) {
$more_link = ' <a class="more-link" href="'.esc_attr(get_permalink($post->ID) . "#more-{$post->ID}").'">'.__('Continue reading', 'zerif-lite').'</a>';
@kharissulistiyo
kharissulistiyo / functions.php
Last active May 2, 2022 16:25
Extending WooCommerce Product Shortcode
<?php
/**
* Extending query parameter of product shortcode
*/
add_filter('woocommerce_shortcode_products_query', 'my_wc_shortcode_product_query_args', 10, 2);
function my_wc_shortcode_product_query_args($args, $atts){
if ( isset( $atts['item'] ) ) {
@kharissulistiyo
kharissulistiyo / functions.php
Created November 18, 2015 01:48
WooCommerce display product stock availability status without managing stock level
<?php
add_filter('woocommerce_get_availability', 'my_availability_message', 10, 2);
function my_availability_message($args, $product){
$args = array(
'availability' => __('Always Available', 'textdomain'),
'class' => 'always-available'
);
@kharissulistiyo
kharissulistiyo / functions.php
Last active November 18, 2015 01:30
WooCommerce Product Query by Author
<?php
add_action( 'woocommerce_product_query', 'my_custom_query_by_author', 10, 2 );
function my_custom_query_by_author($q, $product){
$author = $_GET['creator']; // Author ID param
if( isset($author) && $author != '' ){
$q->set('author', $author);
}