私はこれに何日も苦労してきました...うまくいけば、これはそれにいくらかの光をもたらすでしょう。
私はポートフォリオWPを構築しています。fancyboxを呼び出すa.video要素を含む画像のサムネイルのみが表示されます。タグの属性には、fancyboxがコンテンツをロードするための情報が含まれています。「href=」は表示する動画のURL、「title=」は投稿のタイトルなどです。
どういうわけか、投稿のコンテンツをファンシーボックスウィンドウに表示し、タイトル(ビデオの下のキャプション)として表示したいと思います。
これまでの私のアプローチは、投稿のコンテンツを<a>
タグに入れ、そのコンテンツをFBox.jsファイルに渡すことでした。
投稿コンテンツ(the_content)を<a>
eventid =のカスタム属性に移動し、タグの内側にも移動しました。
私はそれを機能させています:投稿コンテンツは「eventid=」属性と<a>
タグ内のテキストの両方としてインデックスページにロードされます。
これは、Fbox呼び出し要素がインデックスのWPループ内にロードされる方法です。
<a class="thumbnail-frame excerpt-text <?php if($video_url !='' || $embeded_code != '') : ?>video<?php else: ?>shots<?php endif; ?>"
<?php if($video_url !='' || $embeded_code != '') : ?><?php else: ?>rel="set-<?php the_ID(); ?>"<?php endif; ?>
href="<?php if($video_url !='' || $embeded_code != '') : ?>#embed-<?php the_ID(); ?><?php else: ?><?php echo $upload_image_1; ?><?php endif; ?>"
title="<?php the_title(); ?>" eventid="<?php the_content(); ?>"><span class="post"><?php the_content(); ?></span></a>
ただし、コンテンツがインデックスから取得されてFboxに読み込まれるように、そのテキストをFBoxjavascriptプラグインに送信するのにまだ問題があります。
私がしたことのほとんどは
'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
return '<span id="fancybox-title-over">' + jQuery("a.video").html() + '</span>';
これは、最初の投稿のコンテンツをFbox内にのみ投稿します(最初に見つかったa.video要素のコンテンツを取得します)。
私はで試しました
'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
return '<span id="fancybox-title-over">' + jQuery(this).html() + '</span>';
ただし、nullまたは未定義の値を返し、Fboxに出力します。
私は立ち往生しています。各投稿の特定のテキストコンテンツを取得してFBoxに取り込む方法がわかりません。多分グローバル変数を使うことを考えていましたか?
私は学生なので、明らかに超初心者です。本当にこの障害を乗り越えたいと思っています。
これがブログへのリンクですので、私が話していることを理解してください。
http://realitynext.heliohost.org/wordpress/
ありがとう!