0

WordPressプラグインの機能を拡張して別のパラメーターを受け入れようとしていますが、出力を理解するのに問題があります。私が話しているプラ​​グインはNextGenGalleryであり、説明付きの画像のスライドショーを表示するようにしようとしています。

テーマファイルにスライドショーを表示するために使用しているコードは次のとおりです。

<?php echo nggShow_JS_Slideshow(1,906,358,'caption'); ?>

以下は完全な機能です:

function nggShow_JS_Slideshow($galleryID, $width, $height, $template = '', $class = 'ngg-slideshow') {

global $slideCounter;

$ngg_options = nggGallery::get_option('ngg_options');

// we need to know the current page id
$current_page = (get_the_ID() == false) ? rand(5, 15) : get_the_ID();
// look for a other slideshow instance
if ( !isset($slideCounter) ) $slideCounter = 1; 
// create unique anchor
$anchor = 'ngg-slideshow-' . $galleryID . '-' . $current_page . '-' . $slideCounter++;

if (empty($width) ) $width  = (int) $ngg_options['irWidth'];
if (empty($height)) $height = (int) $ngg_options['irHeight'];

//filter to resize images for mobile browser
list($width, $height) = apply_filters('ngg_slideshow_size', array( $width, $height ) );

$width  = (int) $width;
$height = (int) $height;

$out  = '<div id="' . $anchor . '" class="' . $class . '" style="height:' . $height . 'px;width:' . $width . 'px;">';
$out .= "\n". '<div id="' . $anchor . '-loader" class="ngg-slideshow-loader" style="height:' . $height . 'px;width:' . $width . 'px;">';
$out .= "\n". '<img src="'. NGGALLERY_URLPATH . 'images/loader.gif" alt="" />';
$out .= "\n". '</div>';
$out .= '</div>'."\n";
$out .= "\n".'<script type="text/javascript" defer="defer">';
$out .= "\n" . 'jQuery(document).ready(function(){ ' . "\n" . 'jQuery("#' . $anchor . '").nggSlideshow( {' .
        'id: '      . $galleryID    . ',' . 
        'fx:"'      . $ngg_options['slideFx'] . '",' .
        'width:'    . $width        . ',' . 
        'height:'   . $height       . ',' .
        'template:' . $template . ',' .
        'domain: "' . trailingslashit ( home_url() ) . '",' .
        'timeout:'  . $ngg_options['irRotatetime'] * 1000 .
        '});' . "\n" . '});';
$out .= "\n".'</script>';

return $out;
}

問題は、関数に追加した「template」パラメーターです。なんらかの理由で機能しません。スライドショーは永久に読み込まれ続けます。あなたはここで完全なnggfunctions.phpファイルを見ることができます。そして、このライブを見ることができたウェブサイトはこれです。また、PHPは私の強みの1つではないことにも言及する必要があります。

後で編集:各画像の説明を関数に直接追加し、それを「テンプレート」パラメーターに渡さない方法はありませんか?

4

0 に答える 0