Skip to content

Instantly share code, notes, and snippets.

View yaulaannl's full-sized avatar

Alan Luo yaulaannl

View GitHub Profile
$(window).load( function(){
/* Get toggle effect on header menu */
/* preparation: wrap menu text with <span> tag and add empty span tag */
$("#menu-primary-menu>li.menu-item>a").each( function(){
$(this).contents().eq(0).wrap('<span class=\"menu-text-switch\">');
});
/* Fixing width so menu item didn't change width */
$("#menu-primary-menu>li.menu-item").each( function(){
//distinguish between two header menu modes
if($(window).width() > 768){
/*1. Hide the content when not inside*/
.menu-footer-menu-container .menu-item-type-post_type,
.menu-footer-menu-container .menu-item-type-taxonomy{
overflow: hidden;
}
/*2. Specify transition */
.menu-footer-menu-container .menu-item-type-post_type a,
.menu-footer-menu-container .menu-item-type-taxonomy a{
display: inline-block;
transition: all 0.3s;
@yaulaannl
yaulaannl / gist:5e7d8fc06aa7a241ee798f8207587b55
Created June 18, 2017 10:35
Old CSS segment for toggling text and font awesome symbol display
.menu-item-type-post_type,
.menu-item-type-taxonomy{
position: relative;
display: inline-block;
/*to hide contentt*/
overflow: hidden;
}
.menu-item-type-post_type a,
.menu-item-type-taxonomy a{
@yaulaannl
yaulaannl / get-flickr-album-photos.py
Created April 1, 2017 14:39
Python script to get wordpress embed codes for a Flickr album
# Getting Flickr's photos in an album
# Input Parameters:
# api_key
# user_id
# photoset_id
#
# Output:
# A text file with many wordpress embed codes
#
# steps:
//get category id
$cat_id = get_cat_id(single_cat_title("",false));
$featured_IDs = array();
//get the three manual IDs
for($i = 0; $i < 3; $i++){
$field_name = 'featured_post_id_'.($i+1);
$feat_ID = get_field($field_name,'category_'.$cat_id);
if($feat_ID && (intval($feat_ID) > 0) && (get_post_status($feat_ID) == 'publish')){
@yaulaannl
yaulaannl / content-tutorial.php
Created December 19, 2016 08:02
Wordpress custom post query example
<?php $loop = new WP_Query( array( 'post_type' => 'tutorial', 'orderby' => 'post_id', 'order' => 'DSC','posts_per_page' => -1 ) ); ?>
<?php if ( $loop->have_posts() ) : ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<div class="row tutorial-list">
<a href="<?php echo esc_url(get_permalink()); ?>" >
<span class="link-spanner"></span>
</a>
<div class="col-sm-3">
<h4><?php the_field('type'); ?></h4>
</div>