サポート » 使い方全般 » 関連記事枠の一つにJSタグを設置したい

  • 解決済 ram0531

    (@ram0531)


    はじめまして。色々調べたのですがネット検索では解決せず こちらで質問させていただきます。

    現在、TCD有料テーマのOpinionを使用しております。
    関連記事枠に5件記事が表示されるようになっているのですが、その内一つの関連記事枠を広告(ネイティブ)にしたいのですが、それは可能でしょうか?
    問題のサイト「ゲームの館」

    表示する関連記事を4にした場合、枠が一つ空くのでそこへ広告タグを貼りたいのです。
    自身で色々いじってみたのですが、広告が表示されずどうしても自己解決できませんでしたので アドバイスを宜しくお願いします。

    single.phpの関連記事の所は、下記のように構成されています。

    <?php // related post
    if ($options[‘show_related_post’]) :
    $categories = get_the_category($post->ID);
    if ($categories) {
    $category_ids = array();
    foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;
    $args=array(
    ‘category__in’ => $category_ids,
    ‘post__not_in’ => array($post->ID),
    ‘showposts’=>5,
    ‘orderby’ => ‘rand’
    );
    $my_query = new wp_query($args);
    $i = 1;
    if($my_query->have_posts()) {
    ?>
    <div id=”related_post”>
    <h3 class=”headline2″><?php _e(“Related post”,”tcd-w”); ?></h3>
    <ul class=”clearfix”>
    <?php while ($my_query->have_posts()) { $my_query->the_post(); ?>
    <li class=”num<?php echo $i; ?> clearfix”>
    “><?php if ( has_post_thumbnail()) { the_post_thumbnail(‘size3’); } else { echo ‘<img src=”‘; bloginfo(‘template_url’); echo ‘/img/common/no_image3.jpg” alt=”” title=”” />’; }; ?>
    <h4 class=”title”>“><?php trim_title(32); ?></h4>

    <?php $i++; }; ?>

    </div>
    <?php }; }; wp_reset_query(); ?>
    <?php endif; ?>

    <?php if ($options[‘show_comment’]) : if (function_exists(‘wp_list_comments’)) { comments_template(”, true); } else { comments_template(); }; endif; ?>

    <?php if ($options[‘show_next_post’]) : ?>
    <div id=”previous_next_post” class=”clearfix”>
    <p id=”previous_post”><?php previous_post_link(‘%link’) ?></p>
    <p id=”next_post”><?php next_post_link(‘%link’) ?></p>
    </div>
    <?php endif; ?>

1件の返信を表示中 - 1 - 1件目 (全1件中)
  • トピック投稿者 ram0531

    (@ram0531)

    表示の件数は変えず、ワールドプレスのスマホのみ表示させたかったので、

    <div id=”related_post”>
    <h3 class=”headline2″><?php _e(“Related post”,”tcd-w”); ?></h3>
    <ul class=”clearfix”>
    上記のタグの後に、下記のようにモバイル関数を使用し記入した所、思い通りの表示ができました。

    <?php if(wp_is_mobile()): ?><script type=”text/javascript”>
    <!–
    document.write(unescape(“%3Cscript src=’//chomolungma.jp/b2ipaddsub0f5t93/?_t=”+(new Date().getTime())+”‘ type=’text/javascript’%3E%3C/script%3E”));
    // –>
    </script><?php endif; ?>

1件の返信を表示中 - 1 - 1件目 (全1件中)
  • トピック「関連記事枠の一つにJSタグを設置したい」には新たに返信することはできません。