kurageotoko
フォーラムへの返信
2件の返信を表示中 - 1 - 2件目 (全2件中)
-
フォーラム: テーマ
返信が含まれるトピック: オリジナルのヘッダー画像にリンクを付けたいちょっとやりたい事がよくわかりませんが、aタグに背景画像を置けば画像にリンクが貼ったようにみえます。
display: block;でブロック要素にします。#header #header-info h1 a { width:297px; height:画像の高さ; background: url("images/logo.png") no-repeat; display: block; }
フォーラム: テーマ
返信が含まれるトピック: トップページに特定のカテゴリーの記事と特定のページを表示したいありがとうございます。
うまくできました。
コードを載せておきます。index.php(トップページ)
・特定の記事(ID1)の記事を表示
・特定のページ(ID154)のカスタムフィールド(top_photo)を表示<?php if (is_home()) query_posts('cat=1&showposts=1'); ?> <h2><a href="<?php the_permalink(); ?>" title="<?php the_title();?>"><?php the_title();?></a></h2> <p>カテゴリー: <?php the_category(' , '); ?> | <?php the_time('Y年n月j日'); ?> <?php the_time(); ?></p> <?php if(have_posts()) : while(have_posts()) : the_post(); ?> <?php the_content(); ?> <p><small><a href="<?php comments_link(); ?>"><?php comments_number(); ?></a> | タグ: <?php echo(get_the_tag_list('','、','')); ?></small></p> <?php endwhile; else: ?> <?php _e('記事がありません。'); ?> <?php endif; ?> <?php $custom_page = get_posts('include=154&post_type=page'); foreach($custom_page as $post) : setup_postdata($post); $cat = get_post_meta($post->ID, 'top_photo', true); if( $cat != "1" ) { echo '' . $cat . ''; } endforeach; ?>
foreachの部分取ると動きませんでした。やり方がまずいのかもしれないですが。
wordpressはこれからサイトぽい作りをする場合が多くなるのではないかなぁと思います。shokun0803さんに感謝です。
大変助かりました。
2件の返信を表示中 - 1 - 2件目 (全2件中)