Skip to content

Instantly share code, notes, and snippets.

View kogai's full-sized avatar
👁️
Watching you

Shinichi Kogai kogai

👁️
Watching you
View GitHub Profile
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>
<?php endwhile; ?>
<?php else : ?>
記事が見つかりませんでした。
<?php endif; ?>
<!--投稿者IDを取得-->
<?php $aID = get_the_author_meta('ID');?>
<!--投稿者画像(カスタムフィールド)の情報を取得-->
<?php
$attachment_id = get_the_author_meta('profilePhoto');
$size = "full"; // (thumbnail, medium, large, full or custom size)
$imageTest = wp_get_attachment_image_src($attachment_id, $size);
?>
<img src="<?php echo $imageTest[0];?>" alt="">
$(document).ready(function(){
$("a").each(function(i){
$(this).attr("href",$(this).attr("href").replace("</br>",""));
})
});
<?php
$birthDay = 19990701 ;// Your birth day
$age = (int) ((date('Ymd')-$birthDay)/10000);
echo $age;
?>
// 設定されたbackground-imageのurlを無効にする場合
$('#hoge').css('background-image', 'none');
// background-imageのurlを変更する場合
$('#hoge').css('background-image', 'url(test.png)');
/*html5リセット*/
html, body, div, span, object, iframe,h1, h2, h3, h4, h5, h6, p, blockquote, pre,abbr, address, cite, code,del, dfn, em, img, ins, kbd, q, samp,small, strong, sub, sup, var,b, i,dl, dt, dd, ol, ul, li,fieldset, form, label, legend,table, caption, tbody, tfoot, thead, tr, th, td,article, aside, canvas, details, figcaption, figure, footer, header, hgroup, menu, nav, section, summary,time, mark, audio, video {margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent;}body {line-height:1;}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section { display:block;}nav ul {list-style:none;}blockquote, q {quotes:none;}blockquote:before, blockquote:after,q:before, q:after {content:'';content:none;}a {margin:0;padding:0;font-size:100%;vertical-align:baseline;background:transparent;} ins {background-color:#ff9;color:#000;text-decoration:none;} mark {background-color:#ff9;color:#000; font-style:italic;font-weight:bold;}del {text-decoration: line-
@kogai
kogai / imgToBGimg
Created March 7, 2014 07:31
imgをbackground-imageとして挿入
$(window).on("load", function(){
var imgSrc = $("img").attr("src");
var imgSrcHeight = $("img").height();
$('a').css({
'background-image':'url('+imgSrc+')',
'height':imgSrcHeight+'px',
});
$('img').hide();
});
@kogai
kogai / facebook OGP
Created March 28, 2014 05:05
facebook OGP for wordpress
<meta property="og:title" content="<?php wp_title('',true); ?><?php if(wp_title('',false)) { ?> | <?php } ?><?php single_cat_title('',true); ?><?php if(single_cat_title('',false)) { ?> | <?php } ?><?php bloginfo('name'); ?>">
<?php if (is_single() || is_page()) { ?>
<?php while (have_posts()) : the_post(); ?>
<meta property="og:image" content='<?php get_featured_image_url(); ?>'>
<?php endwhile; ?>
<?php } elseif (is_home()) { ?>
<meta property="og:image" content='<?php bloginfo('template_url'); ?>/images/facebookogp.png'>
<?php } else { ?>
<meta property="og:image" content='<?php bloginfo('template_url'); ?>/images/facebookogp.png'>
<?php } ?>
<?php if (have_posts()) : query_posts('cat=15&posts_per_page=-1'); while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink();?>"><?php the_title();?></a>
<?php endwhile; wp_reset_query(); endif; ?>
$('#myList li').mouseover(function() {
$(this).animate({"height": 100}, "slow");
});