• 締切済み

ランラム表示

よろしくお願いシアンス^^ ランダム表示について 貼り付けのURLの変更が色々変えてみたんですがエラーが出ますよろしくお願いします。 WordPress のテーマに表示させたいんですが banner.phpの内容 <?php $bnSrc[0]='<a href="http://xxxxx.jp/home/" target="_blank"><img src="http://xxxxx.jp/home/wp-content/themes/kaeruba/images/top_img_l/1.jpg" alt="バナー1" border="0" /></a>'; $bnSrc[1]='<a href="http://xxxxx.jp/home/" target="_blank"><img src="http://xxxxx.jp/home/wp-content/themes/kaeruba/images/top_img_l/2.jpg" alt="バナー2" border="0" /></a>'; $bnSrc[2]='<a href="http://xxxxx.jp/home/" target="_blank"><img src="http://xxxxx.jp/home/wp-content/themes/kaeruba/images/top_img_l/3.jpg" alt="バナー2" border="0" /></a>'; $n = mt_rand(0,count($bnSrc)-1); $bn = $bnSrc[$n]; echo $bn; ?> 貼り付け <?php $openfile = file_get_contents('http://xxxxx.jp/home/wp-content/themes/kaeruba/images/top_img_l/banner.php');// echo $openfile;// ?> 上記のURLの部分を<?php bloginfo('template_url');?>を使うとエラーが出ます 根本的に<?php bloginfo('template_url');?>は使えないのでしょうか

  • PHP
  • 回答数1
  • ありがとう数0

みんなの回答

  • ts3m-ickw
  • ベストアンサー率43% (1248/2897)
回答No.1

bloginfo()の中の'をエスケープしてないんじゃない?

関連するQ&A

  • wordpressのjqueryが動かない

    wordpress3.8.1で作業しています。 会社のHPの作成用途でwordpressを使用しています。 何度か作成経験がありphpもなんとなく分かっているのですが、ここだけ解決せずです。 トップページにスライドショーのプラグインを入れたのですが動きません。 プラグインはWP-Cycleというプラグインです。 function.phpにはまだ何も記載していません。 header.phpはこんな感じの記載です。 ******************************************* <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html <?php language_attributes(); ?>> <head> <meta charset="<?php bloginfo( 'charset' ); ?>" /> <meta name="description" content="<?php bloginfo( 'description' ); ?>"> <title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> &raquo; Blog Archive <?php } ?> <?php wp_title(); ?></title> <link rel="shortcut icon" href="<img src="<?php bloginfo('template_url'); ?>/images/favicon.ico" /> <link href="<?php bloginfo('stylesheet_url'); ?>" rel="stylesheet" type="text/css" /> <?php wp_head(); ?> </head> <body> <a name="pagetop_here"></a> <div class="wrap"> <div class="header"> <h1 class="h_logo"><a href="<?php echo esc_url( home_url( '/' ) ); ?>"><img src="<?php bloginfo('template_url'); ?>/images/h_logo.png"/></a></h1> <ul class="h_nav"> <li><a href="<?php echo esc_url( home_url( '/' ) ); ?>"><img src="<?php bloginfo('template_url'); ?>/images/h_01.png"/></a></li> <li><a href="<?php echo esc_url( home_url( '/news' ) ); ?>"><img src="<?php bloginfo('template_url'); ?>/images/h_02.png"/></a></li> <li><a href="<?php echo esc_url( home_url( '/about' ) ); ?>"><img src="<?php bloginfo('template_url'); ?>/images/h_03.png"/></a></li> <li><a href="<?php echo esc_url( home_url( '/works' ) ); ?>"><img src="<?php bloginfo('template_url'); ?>/images/h_04.png"/></a></li> <li><a href="<?php echo esc_url( home_url( '/faq' ) ); ?>"><img src="<?php bloginfo('template_url'); ?>/images/h_05.png"/></a></li> <li><a href="<?php echo esc_url( home_url( '/company' ) ); ?>"><img src="<?php bloginfo('template_url'); ?>/images/h_06.png"/></a></li> <li><a href="http://ameblo.jp/ecoblue-smile/" target="_blank"><img src="<?php bloginfo('template_url'); ?>/images/h_07.png"/></a></li> <li><a href="<?php echo esc_url( home_url( '/contact' ) ); ?>"><img src="<?php bloginfo('template_url'); ?>/images/h_08.png"/></a></li> </ul><!--h_nav--> </div><!--header--> ******************************************* <?php wp_head(); ?>を無効にして外部の jqueryを読み込むにすると、スライドはおろか、縦に並んでしまいます。(cssが効いていないみたいです。) どこが原因なのかも分からないです。 ただ過去に同じheader.phpで同じプラグインが実装しています。 よろしくお願い致します。

    • ベストアンサー
    • PHP
  • wordpressのタグについて

    ワードプレスの教科書の本に沿って勉強しているのですが、さっそく躓いてしまいました。。 よろしくお願いいたします。 テーマ作成で、プライムストラテジーのサイトからpacificという練習用テーマをダウンロードし、 xamppでローカル開発環境を準備した中に入れ、ソースをwpテンプレートタグに置き換えを行っているのですが、cssファイルの置き換えは問題ないのですが、テーマファイルディレクトリの置き換えがうまくできません。。 たとえば、cssは、 <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo('stylesheet_url'); ?>" />    ↓↓↓ <link rel="stylesheet" type="text/css" media="all" href="http://localhost/wordpress/wp-content/themes/pacific/style.css" /> で、ちゃんと表示されている。 テーマファイルディレクトリは、 href="<?php bloginfo('templete_url'); ?>/images/touch-icon.png"    ↓↓↓ href="wp/images/touch-icon.png" ソースの一部↓ ----------------------------------------------------------- <!DOCTYPE HTML> <html dir="ltr" lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>title</title> <link rel="apple-touch-icon" href="wp/images/touch-icon.png" /> <link rel="shortcut icon" href="wp/images/favicon.ico" /> <link rel="stylesheet" type="text/css" media="all" href="http://localhost/wordpress/wp-content/themes/pacific/style.css" /> ・・・ ----------------------------------------------------------- <?php bloginfo('templete_url'); ?>の部分は、wp とだけ表示されてしまうのですが、 http://localhost/wordpress/wp-content/themes/pacific と表示させたいのですが、 この部分はどこを参照しているのでしょうか。 (どこを修正したら、ちゃんと出るようになりますでしょうか。) 不足している情報があれば追加しますので、わかる方がいらっしゃいましたらご教示いただけますと幸いです。 どうぞよろしくお願いいたします。

  • このフォント名を教えてください

    こちらのフォントを教えてください。 ↓ http://lu3.jp/wp-content/themes/fmlu3/img/management/content01_catch01.gif  よろしくお願いします。

  • ページ切り替え時に点線を表示させたまにしたい。

    タイトルが分かりにくく申し訳ございません。 (WordPressを使っています) 現在、TOPページにインラインフレームを使い、新着情報を表示させています。(ページナビ付き) タイトル下には点線をCSSで表示させていました。 ページナビでページを送ると画面が切り替わるので、そのタイミングでタイトル下の点線が一瞬消えてしまいます。(ページ切り替えなので当たり前の動作ですが) 一瞬でも消さない方法はないかと思い、TOPページに画像として位置を合わせて表示させておきました。 インラインフレーム内の新着情報はページナビで切り替わり、点線はTOPページの画像なので表示されたままには出来たのですが、何も考えずにTOPページに貼りつけただけなので、新着情報の件数に関係なく表示されたままになってしまっています。 新着情報の件数に合わせて表示させ、尚且つページ切り替えの影響を受けづに表示させる方法はないでしょうか。 下記にコードを記述しました。 (HP作成は全くのど素人で記述がなっていない点が山ほどあると思います。ご了承ください) ご享受よろしくおねがいします。 <?php if($_SERVER['REQUEST_URI']=="/top/"): ?> // TOPページにインラインフレーム <iframe frameborder="0" src="http://・・・・/category/news" scrolling="no"></iframe> <div id="dot1"> <img src="<?php bloginfo('template_url'); ?>/images/dot.png" ></div>//点線1 <div id="dot2"> <img src="<?php bloginfo('template_url'); ?>/images/dot.png" ></div>//点線2 //…8件分点線の画像を表示 <div id="dot8"> <img src="<?php bloginfo('template_url'); ?>/images/dot.png" ></div>//点線8 <?php endif; ?> //インラインフレーム内(新着情報) <?php query_posts($query_string . '&' .'showposts=10&category_name=news'); if (have_posts()) : while (have_posts()) : the_post(); ?> <h2><?php the_time('Y.m.d') ?> <a> <?php the_title(); ?></a></h2> <?php endwhile; $pt = $wp_query->max_num_pages; endif; ?> //ページナビ用の$pt <?php wp_reset_query(); ?>

    • ベストアンサー
    • PHP
  • Wordpressのサイト内検索ができない。

    お世話になります。 ロリポップにWordpressをインストールしています。 ブログの記事タイトルなどを入力して検索をかけて、該当するエントリが無かったら下記エラーがページ上部に表示されます。 ソースを見るとヘッダー内に記述されています。 Warning: Cannot modify header information - headers already sent by (output started at /home/sites/lolipop.jp/users/○○○○/web/wp/wp-content/themes/○○○○/header.php:8) in /home/sites/lolipop.jp/users/○○○○/web/wp/wp-content/plugins/wp-autopager/wp-autopager.php on line 158 htaccessで制御する方法などあるのでしょうか? どなたかお分かりになる方がおられましたらご教授いただけますでしょうか。 どうぞよろしくお願いいたします。

    • 締切済み
    • PHP
  • Wordpress初心者です

    wordpress初心者です。 wordpressを勉強しようとしていて、最初でつまづいてしまいました。 XAMPPを導入して、htdocs/wordpress/wp-content/themes/twentythirteen/index.php をhttp://localohst/wordpress/wp-content/themes/twentythirteen/index.php で表示させようとしたら、 Fatal error: Call to undefined function get_header() in C:\xampp\htdocs¥wordpress\wp-content\themes\twentythirteen\index.php on line 17 とエラーが出てしまって表示できません。何が原因でどのように対処すればよいのでしょうか? よろしくお願いします。

    • 締切済み
    • CSS
  • wordpressで

    wordpressを使ってブログを作っています。しかしcssを読み込んでくれません。 index.phpの内容は <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" /> <title><?php bloginfo('name'); ?><?php wp_title(': '); ?></title> <meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats please --> <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?>(RSS 2.0)" href="<?php bloginfo('rss2_url'); ?>" /> <link rel="alternate" type="application/atom+xml" title="<?php bloginfo('name'); ?>(Atom)" href="<?php bloginfo('atom_url'); ?>" /> <link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url'); ?>" /> </head> <body> <div id="rap"> <div id="header"> <div id="headerimg"> <h1><a href="<?php echo get_settings('home'); ?>/"><img src="img/title.gif" alt="芦澤治療院はやさしいマッサージで施術いたします。" /></a></h1> </div> <div id="headernavi"> <div id="navi"> <ul> <li><a href="#"><img src="img/link.gif" alt="" border="0" /></a></li> <li><a href="#"><img src="img/sitemap.gif" alt="" border="0" /></a></li> <li><a href="#"><img src="img/inquary.gif" alt="" border="0" /></a></li> </ul></div> <div id="size"> <img src="img/sizeword.gif" alt="" /> <a href="#"><img src="img/sizesmall.gif" alt="" border="0" /></a> <a href="#"><img src="img/sizemiddle.gif" alt="" border="0" /></a> <a href="#"><img src="img/sizebig.gif" alt="" border="0" /></a></div> </div> </div> <div id="navcontainer"> <ul> <li class="news"><a href="#">ニュース</a></li> <li class="cut"><img src="img/linecut.gif" alt="" /></li> <li class="work"><a href="#">施術の案内</a></li> <li class="cut"><img src="img/linecut.gif" alt="" /></li> <li class="stuff"><a href="#">スタッフ</a></li> <li class="cut"><img src="img/linecut.gif" alt="" /></li> <li class="qa"><a href="#">よくある質問</a></li> <li class="cut"><img src="img/linecut.gif" alt="" /></li> <li class="inq"><a href="#">お問い合わせ</a></li> </ul> </div> <!-- end header --> <div id="content"> <div id="main"> <?php if(have_posts()):while(have_posts()):the_post();?> <div class="post"> <h2><?php the_title();?></h2> <?php the_content();?> <p class="postmetadate"> <?php the_time('Y年m月d日 H:i')?>|<?php comments_popup_link ('コメント(1)','コメント(2)','コメント(%)');?> </p> </div> <?php comments_template();?> <?php endwhile;endif;?> </div> </div> </div> </body> </html> です。 ディレクトリ構造はindex.htmlとstyle.cssは同じフォルダにあります。

    • 締切済み
    • PHP
  • jquery スライダーが動かない

    昨日質問をしてなんとかクリアしたのですが、次はスライダーが動かなくて困っています。 問題のサイト:http://snapkidz.biz/wp/ 先日の質問:http://okwave.jp/qa/q7180952.html 教えて頂いたのを元に構築をしてメイン画像部分をスライダーにしようと思い構築したのですがうまくいきませんでした。 <!-- External files --> <link rel="stylesheet" href="<?php bloginfo( 'stylesheet_url' ); ?>"> <!-- Favicon, Thumbnail image --> <link rel="shortcut icon" href="<?php bloginfo('template_url'); ?>/images/favicon.ico"> <?php wp_head(); ?> <!-- ======================================= スライダーテスト ======================================= --> <script type="text/javascript" src="http://snapkidz.biz/slider1/script.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js"></script> <link rel="stylesheet" type="text/css" media="screen" href="http://snapkidz.biz/slider1/style.css" /> </head> <body> <div id="page"> <div id="wrapper"> <div class="header" id="Top"> <h1><img src="http://snapkidz.biz/wp/wp-content/uploads/2011/12/blk_03.jpg" alt="Art・・"></h1> <div class="nav"> <ul> <li class="nav1"><a href=""></a></li> <li class="nav2"><a href=""></a></li> <li class="nav3"><a href=""></a></li> </ul> </div> <div class="siteImage"> <div id="slider"> <div class="slider-view"> <div class="slider-container"> <div><a href="#"><img src="http://snapkidz.biz/slider1/images/image1.jpg" alt="" /></a></div> <div><a href="#"><img src="http://snapkidz.biz/slider1/images/image2.jpg" alt="" /></a></div> <div><a href="#"><img src="http://snapkidz.biz/slider1/images/image3.jpg" alt="" /></a></div> <div><a href="#"><img src="http://snapkidz.biz/slider1/images/image4.jpg" alt="" /></a></div> <div><a href="#"><img src="http://snapkidz.biz/slider1/images/image5.jpg" alt="" /></a></div> </div><!-- // .slider-container --> </div><!-- // .slider-view --> <a href="#" id="slide-prev">&laquo;</a><a href="#" id="slide-next">&raquo;</a> </div> <p><img src="http://snapkidz.biz/wp/wp-content/uploads/2011/12/blk_03.png" alt="" class="top" /></p> </div> でcssが html,body{margin:0;padding:0;} #wrapper{width:980px;margin:0 auto;position:relative;} div.header{border:sold 1px solid;} div.header h1{position:absolute;top:0;left:0;} div.header div.nav ul,div.header div.nav ul li{list-style:none;margin:0;padding:0;} div.header div.nav ul{display:block;height:70px;width:242px;text-align:right;background:url(http://snapkidz.biz/wp/wp-content/uploads/2011/12/blacknav.jpg);background-repeat:no-repeat;position:relative;left:737px;top:40px;} div.header div.nav ul li{display:inline;width:85px;} div.header div.siteImage{position:relative;width:100%;min-width:640px;} div.header div.siteImage img.top{position:absolute;top:-80px;left:400px;} です。 スライダーダウンロード元:http://unformedbuilding.com/articles/jquery-simple-loop-slider/ head部分の記載が違うのかと思ったのですが、そうではないようでした・・・ 何が原因なんでしょうか? 宜しくお願い致します。

  • げん玉のバナーをヤフーブログに

    げん玉のバナーをヤフーブログに <a href="http://www.gendama.jp/invitation.php?frid=2910529"; target="_blank"><img src="http://www.gendama.jp/img/invitation_banner86.gif"; width="500" height="150"></a> 上のヤツを、Wiki文法に変換してください! お願いします それと、簡単モードでの貼り付け方を教えていただけると有り難いです。

  • ハッスルサーバーでwordpress が機能しない

    http://kaitori.cc/ 上記の独自ドメインで  wordpress を  www/kaitori.cc/ 以下にインストールしました。 絶対パスで、css img とリンクしていますが、反映されていません。 例えば、http://kaitori.cc/wp-content/themes/sample2/img/head.jpg" http://kaitori.cc/wp-content/themes/sample2/css/style.css という具合です。ディレクトリーは合っています。 単純なhtmlで試したところ 絶対パスでOKでした。    どなたかハッスルサーバーを使用した人で原因が分かる人はいないでしょうか?