フォーラムへの返信

6件の返信を表示中 - 1 - 6件目 (全6件中)
  • フォーラム: 使い方全般
    返信が含まれるトピック: カテゴリーページでのページング
    トピック投稿者 focs

    (@focs)

    jim912さん

    とてもわかりやすい解説で、勉強になりました。

    表示件数を1にしたところ、無事にページングされるようになりました。
    今作っているサイトでは、特に表示件数を触っても変化しない作りにしていたので、
    すぐに解決いたしました。

    ありがとうございます。

    フォーラム: 使い方全般
    返信が含まれるトピック: 固定ページで、記事の属するカテゴリ名の表示
    focs

    (@focs)

    全く同じかどうかはわかりませんが、私も同じようなことでさっきまで詰まっていました。
    ですが、解決したので、そのソースだけ記載しておきます。

    <?php
    $category = get_the_category();
    echo $category[0]->cat_name;
    ?>

    こちらのタグでカテゴリ名を取得できたので、試してみてはいかがでしょうか?
    だめだったらすみません。。

    フォーラム: プラグイン
    返信が含まれるトピック: ページナビゲーションについて
    トピック投稿者 focs

    (@focs)

    mypacecreatorさん>
    ご返事が遅れてしまい、申し訳ないです。

    ご指摘頂いたquery_postsの使い方を変更し、

    <?php if (have_posts()) : query_posts(‘cat=3&posts_per_page=5&paged=’.$paged); ?>

    <?php while (have_posts()) : the_post(); ?>

    <div class=”box”>
    <h3><table width=”535″ height=”32″ border=”0″ cellpadding=”0″ cellspacing=”0″>
    <tr>
    <td background=”<?php bloginfo(‘template_url’); ?>/img/mdsbg.gif” class=”mdsbg”><?php the_time(‘Y.n.j’); ?>  <?php the_title(); ?></td>
    </tr>
    </table>
    </h3>
    <?php the_content(); ?>

    という風に、get_postsを使わずに読み込んだところ、ページングにたどり着くことが出来ました。

    ご指摘頂いた通りで、とても助かりました。
    ありがとうございます。

    トピック投稿者 focs

    (@focs)

    jim912さん
    ありがとうございました。
    上記のコードでちゃんと動きました。
    とても助かりました。

    これからも機会があればよろしくお願い致します。。

    http://wptest05.ne-co.info/2011/07/27/%E3%81%82/
    ↑動いたサイトがこちらです。

    トピック投稿者 focs

    (@focs)

    jim912さん、ご連絡が遅れてしまい、申し訳ございません。

    spanタグ、aタグは無事に成功しました。
    御回答いただきありがとうございます。

    <td class=”jswap_l” rowspan=”4″>にスワップイメージの大きい画像を入れたいのですが、入れ方が分からない

    に関してですが、具体的にどこに入れればよいかが分からず、困ってしまいました。

    <?php
    /* functions.php *
    テーマにさまざまな付加機能を設定するためのファイル。
    */
    function remove_gallery_css() {
    return “”;
    }
    add_filter(‘gallery_style’, ‘remove_gallery_css’);

    function fix_gallery_output( $output ){
    $output = preg_replace(“%</div>%”, “</tr>”, $output);

    /* br clear を削除 */
    $output = preg_replace(“%<br style=.*clear: both.* />%”, “”, $output);

    return $output;
    }
    add_filter(‘the_content’, ‘fix_gallery_output’,11, 1);

    /* デフォルトのショートコードを削除 */
    remove_shortcode(‘gallery’, ‘gallery_shortcode’);

    /* 新しい関数を定義 */
    add_shortcode(‘gallery’, ‘my_gallery_shortcode’);

    function my_gallery_shortcode($attr) {
    global $post, $wp_locale;

    static $instpe = 0;
    $instpe++;

    // Allow plugins/themes to override the default gallery template.
    $output = apply_filters(‘post_gallery’, ”, $attr);
    if ( $output != ” )
    return $output;

    // We’re trusting author input, so let’s at least make sure it looks like a valid orderby statement
    if ( isset( $attr[‘orderby’] ) ) {
    $attr[‘orderby’] = sanitize_sql_orderby( $attr[‘orderby’] );
    if ( !$attr[‘orderby’] )
    unset( $attr[‘orderby’] );
    }

    extract(shortcode_atts(array(
    ‘order’ => ‘ASC’,
    ‘orderby’ => ‘menu_order ID’,
    ‘id’ => $post->ID,
    ‘itemtag’ => ‘dl’,
    ‘icontag’ => ‘dt’,
    ‘captiontag’ => ‘dd’,
    ‘columns’ => 3,
    ‘size’ => ‘thumbnail’,
    ‘include’ => ”,
    ‘exclude’ => ”
    ), $attr));

    $id = intval($id);
    if ( ‘RAND’ == $order )
    $orderby = ‘none’;

    if ( !empty($include) ) {
    $include = preg_replace( ‘/[^0-9,]+/’, ”, $include );
    $_attachments = get_posts( array(‘include’ => $include, ‘post_status’ => ‘inherit’, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘order’ => $order, ‘orderby’ => $orderby) );

    $attachments = array();
    foreach ( $_attachments as $key => $val ) {
    $attachments[$val->ID] = $_attachments[$key];
    }
    } elseif ( !empty($exclude) ) {
    $exclude = preg_replace( ‘/[^0-9,]+/’, ”, $exclude );
    $attachments = get_children( array(‘post_parent’ => $id, ‘exclude’ => $exclude, ‘post_status’ => ‘inherit’, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘order’ => $order, ‘orderby’ => $orderby) );
    } else {
    $attachments = get_children( array(‘post_parent’ => $id, ‘post_status’ => ‘inherit’, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘order’ => $order, ‘orderby’ => $orderby) );
    }

    if ( empty($attachments) )
    return ”;

    if ( is_feed() ) {
    $output = “\n”;
    foreach ( $attachments as $att_id => $attachment )
    $output .= wp_get_attachment_image($att_id, $size, true) . “\n”;
    return $output;
    }

    $itemtag = tag_escape($itemtag);
    $captiontag = tag_escape($captiontag);
    $columns = intval($columns);
    $itemwidth = $columns > 0 ? floor(100/$columns) : 100;
    $float = is_rtl() ? ‘right’ : ‘left’;

    $selector = “gallery-{$instpe}”;

    $output = apply_filters(‘gallery_style’, “
    <style type=’text/css’>
    #{$selector} {
    margin: auto;
    }
    #{$selector} .gallery-item {
    float: {$float};
    margin-top: 10px;
    text-align: center;
    width: {$itemwidth}%; }
    #{$selector} img {
    border: 2px solid #cfcfcf;
    }
    #{$selector} .gallery-caption {
    margin-left: 0;
    }
    </style>
    <!– see gallery_shortcode() in wp-includes/media.php –>
    <div id=’$selector’ class=’gallery galleryid-{$id}’>”);

    $i = 0;
    foreach ( $attachments as $id => $attachment ) {
    $link = isset($attr[‘link’]) && ‘file’ == $attr[‘link’] ? wp_get_attachment_image($id, $size, false, false) : wp_get_attachment_image($id, $size, true, false);
    $output .= “<{$itemtag} >”;
    $output .= “
    $link
    </{$icontag}>”;
    if ( $captiontag && trim($attachment->post_excerpt) ) {
    $output .= “
    <{$captiontag} class=’gallery-caption’>
    ” . wptexturize($attachment->post_excerpt) . “
    </{$captiontag}>”;
    }
    $output .= “</{$itemtag}>”;
    if ( $columns > 0 && ++$i % $columns == 0 )
    $output .= ‘<br style=”clear: both” />’;
    }

    $output .= “
    <br style=’clear: both;’ />
    </div>\n”;

    return $output;
    }

    ?>

    大変恐縮ではございますが、再度function.phpの全文を記載致しますので、
    どう入れればいいか御指導をお願い致します。

    もう1つ、追加でご質問があります。

    <tr>
    <td class="jswap_l" rowspan="4"></td>
    </tr>
    
    <tr>
    <td>
    <img height="150" width="150" title="Blue hillsa" alt="Blue hillsa" class="attachment-thumbnail" src="http://wptest05.ne-co.info/wp-content/uploads/2011/07/Blue-hills-150x150.jpg">
    </td>

    現状のHTMLソースは上記のようになっておりますが、

    <tr>
    <td class="jswap_l" rowspan="4"></td>
    </tr>
    
    <tr>
    <td class="jswap_s">
    <img height="150" width="150" title="Blue hillsa" alt="Blue hillsa" class="attachment-thumbnail" src="http://wptest05.ne-co.info/wp-content/uploads/2011/07/Blue-hills-150x150.jpg">
    </td>

    というクラスをつけたいのですが、つけ方がわからない状態です。

    度々申し訳ございませんが、よろしくお願い致します。

    トピック投稿者 focs

    (@focs)

    jim912さん、ご返答いただきありがとうございます。

    表現できない部分としては、
    ・spanタグが入ってしまう
    ・aタグを消したい
    ・<td class=”jswap_l” rowspan=”4″>にスワップイメージの大きい画像を入れたいのですが、
    入れ方が分からない

    の3点です。
    お手数ですが、ご指導をお願い致します。

6件の返信を表示中 - 1 - 6件目 (全6件中)