Skip to content

Instantly share code, notes, and snippets.

@furahaclothing
furahaclothing / fly-out menus
Created August 10, 2012 03:55
fly-out menus(フライアウトメニュー)
/* common styling */
.menu1{
font-family: arial, sans-serif; width:100px; height:180px; position:relative; font-size:11px; margin:30px 0; background:#eee; padding:25px 10px; border:1px solid #888;
}
.menu1 ul {
padding:0; margin:0; list-style-type: none;
}
.menu1 ul li ul {
visibility:hidden; position:absolute; height:0; overflow:hidden; top:-1px; left:99px;
}
@furahaclothing
furahaclothing / gist:3310998
Created August 10, 2012 04:12
カスタム投稿にもタグとカテゴリーを加える-function.php-
add_action( ‘init’, ‘create_post_type’ );
function create_post_type() {
register_post_type( ‘blog’, /* post-type */
array(
‘labels’ => array(
‘name’ => __( ‘ブログ’ ),
‘singular_name’ => __( ‘ブログ’ )
),
‘public’ => true,
‘supports’ => array( ‘title’, ‘editor’, ‘author’, ‘thumbnail’, ‘excerpt’, ‘custom-fields’ ,’comments’ ),
@furahaclothing
furahaclothing / gist:3312764
Created August 10, 2012 09:05
カスタム投稿の月別アーカイブ-sidebar.php-
<?php
if (!is_home() && !is_page() || is_page_template() ) {
echo '<h2 class="posttype-' .get_post_type(). '">';
if ( get_post_type() === 'post' ){
echo 'カスタム投稿タイプが「post」のときのタイトル';
} else {
$customPostTypeObj = get_post_type_object(get_post_type());
echo esc_html($customPostTypeObj->labels->name);
}
echo '</h2>';
@furahaclothing
furahaclothing / gist:3312759
Last active October 8, 2015 09:29
カスタム投稿の月別アーカイブ-function.php-
add_filter( 'getarchives_where', 'my_getarchives_where', 10, 2 );
function my_getarchives_where( $where, $r ) {
global $taxonomy_getarchives_data;
if ( isset($r['post_type']) ){
$taxonomy_getarchives_data['post_type'] = $r['post_type'];
$where = str_replace( '\'post\'', '\'' . $r['post_type'] . '\'',
$where );
}
return $where;
}
@furahaclothing
furahaclothing / gist:3312774
Created August 10, 2012 09:07
welcart-カートの中を表示-
<ul><li><h3>合計金額:¥<?php usces_totalprice_in_cart(); ?>(送料・税別)</h3></li>
<li>現在の商品数:<?php usces_totalquantity_in_cart(); ?></li>
<a href="/usces-cart/">カートの中身を見る
</ul>
@furahaclothing
furahaclothing / gist:3312783
Created August 10, 2012 09:10
wordpress-カテゴリーのメニューをドロップダウン-
<li id="categories">
<h2><?php _e('Categories:'); ?></h2>
<form action="<?php bloginfo('url'); ?>/" method="get">
<?php
$select = wp_dropdown_categories('show_option_none=Select Category&show_count=1&orderby=name&echo=0&selected=6');
$select = preg_replace("#<select([^>]*)>#", "<select$1 onchange='return this.form.submit()'>", $select);
echo $select;
?>
<noscript><input type="submit" value="View" /></noscript>
</form>
@furahaclothing
furahaclothing / gist:3312795
Created August 10, 2012 09:12
css-伸びる検索窓-
#search {
-webkit-transition-duration: 400ms;
-webkit-transition-property: width, background;
-webkit-transition-timing-function: ease;
-moz-transition-duration: 400ms;
-moz-transition-property: width, background;
-moz-transition-timing-function: ease;
-o-transition-duration: 400ms;
-o-transition-property: width, background;
-o-transition-timing-function: ease;
@furahaclothing
furahaclothing / gist:3423170
Created August 22, 2012 07:04
wordpress-カスタム投稿ループの表示-
<div class="title"><?php _e('Blog Article','usces') ?></div>
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$newloop = new WP_Query(array(
'post_type' => blog,
'posts_per_page' => 4,
'paged' => $paged
));
if ($newloop->have_posts()) :
while ($newloop->have_posts()) : $newloop->the_post();
@furahaclothing
furahaclothing / gist:3423039
Created August 22, 2012 06:40
thumnail loop
<div class=”thumbnail_box”>
<div class=”thumimg”><a href=”<?php the_permalink() ?>”><?php usces_the_itemImage($number = 0, $width = 150, $height = 150 ); ?></a></div>
<div class=”thumtitle”><a href=”<?php the_permalink() ?>” rel=”bookmark”><?php usces_the_itemName(); ?></a></div>
<?php if (usces_is_skus()) : ?>
<div class=”price”><?php usces_crform( usces_the_firstPrice(‘return’), true, false ); ?><?php usces_guid_tax(); ?></div>
<?php endif; ?>
</div><!– thumbnail_box –>
@furahaclothing
furahaclothing / gist:3423107
Created August 22, 2012 06:53
welcart-お勧め商品の表示-
<?php $reco_ob = new wp_query(‘showpost=●&cat=●’); ?>
<?php if ($reco_ob->have_posts()) : while ($reco_ob->have_posts()) : $reco_ob->the_post(); usces_the_item(); ?>
<div class=”thumbnail_box”>
<div class=”thumimg”><a href=”<?php the_permalink() ?>”><?php usces_the_itemImage($number = 0, $width = 150, $height = 150 ); ?></a></div>
<div class=”thumtitle”><a href=”<?php the_permalink() ?>” rel=”bookmark”><?php usces_the_itemName(); ?></a></div>
<?php if (usces_is_skus()) : ?>
<?php endif; ?>
</div>