Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Set event month filter at Event post type admin column
*/
add_filter( 'query_vars', 'goto_calendar_register_query_vars' );
function goto_calendar_register_query_vars( $qvars ) {
//Add these query variables
$qvars[] = 'custom_month';
return $qvars;
@marushu
marushu / wp-config-add-define.php
Created February 28, 2016 02:55
wp-config.phpへ追加するヤツ
<?php
/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*/
define('WP_DEBUG', false);
//define('WP_DEBUG', true);
@marushu
marushu / get_post_thumbnail_url.php
Last active February 21, 2016 03:52
Get post thumbnail image's url.
<?php
if( has_post_thumbnail() ) {
$thumbnail_id = get_post_thumbnail_id( get_the_ID() );
$image_obj = wp_get_attachment_image_src( $thumbnail_id, 'full' );
echo '<pre>';
print_r( $image_obj[0] );
echo '</pre>' . "\n";
$image_url = esc_url( $image_obj[0] );
}
<?php
function get_dynamic_sidebar( $name ) {
$contents = "";
ob_start();
dynamic_sidebar( $name );
$contents = ob_get_clean();
return $contents;
}
@marushu
marushu / flexslider-full-size-image.js
Last active January 22, 2016 02:52
Each slider image set to background image.If you set style(background-size: cover), FlexSlider is now full screen.
/**
* Change image tag to this parent background image.
*/
( function( $ ){
$.when(
$.each( $( '.slides li' ),
function( index, elem ){
$.when($(introBg).delay(1500).fadeIn(5000, 'easeInOutCubic', function(){
$(this).parent().fadeOut(3000, 'easeInOutCubic');
})).then(function(){
$(".flex-outer").delay(3000).animate({opacity: 1}, 3000, 'easeInOutCubic', function(){
$("#test").delay(2000).animate({opacity: 1});
$("#logo-for-slide").delay(2000).animate({opacity: 1});
/*--------------------------------------------------------------
# OpeningHours table.
--------------------------------------------------------------*/
.opening-hours {
background-color: #fff;
border: 2px solid #999;
table {
text-align: center;
color: #42210B;
<div class="opening-hours">
<table summary="受付時間">
<thead>
<tr>
<th class="open-close">受付時間</th>
<th>月</th>
<th>火</th>
<th>水</th>
<th>木</th>
<th>金</th>
#!/bin/sh
# Start MailCatcher
vagrant ssh -c 'mailcatcher --http-ip=$(ohai | jq -r .network.interfaces.eth1.routes[0].src)'
@marushu
marushu / custom-post-type-widget-recent-post-extend.php
Last active December 19, 2015 07:09
Override custom post type widgets plugin class
<?php
/**
* Class WP_Widget_Recent_Posts_Be_will_Test
* override custom-post-type-widget at widget-custom-post-type-recent-posts.php
* https://wordpress.org/plugins/custom-post-type-widgets/
*/
class WP_Widget_Recent_Posts_Be_will extends WP_Widget {
public function __construct() {
$widget_ops = array( 'classname' => 'widget_recent_entries', 'description' => 'カスタム投稿タイプWidgetの最近の投稿' );