English 中文(简体)
Wordpress PHP 条件
原标题:Wordpress PHP Condition

我的网页有一个垂直的电梯,显示我的主页上5个员额的名称。 每个显示其背景形象的岗位都有自己的形象。 目前,它运作良好,尽管我将在每个员额展示出不同的背景形象。 我不知道如何使用购买力平价代码来做到这一点。 我将《守则》张贴在后面,显示载有J Carousel功能的文件。 我猜测,我需要确定某种条件,使每个清单项目有新的背景形象?

该法典:

<div id="home-gallery-wrapper">
<ul id="home-gallery" class="jcarousel-skin-home clearfix">

<?php
global $post;

if ( get_option( minimax_hl_show ) ==  1  ) {
    $my_query = get_pages( include= .get_option( minimax_hl_ID ).  );
} else {
    $my_query = get_posts( include= .get_option( minimax_hl_ID ).  );
}
foreach($my_query as $post) :
    setup_postdata($post);
?>

<li style="width:910px"><div style="
background:url( <?php bloginfo( template_directory ); ?>/images/banner3.png ) 
center top no-repeat;">
                                          <table align="center" style="width:910px;
height:200px">
<tr>
<td style="vertical-align:top">
<div style="width:90%; display:block; margin-left:auto; margin-right:auto">
<h2 style="text-align:center; border:none; text-decoration:none; font-family:calligraffiti;
 margin-top:15px; font-size:1.8em; line-height:35px; color:#fff; position:relative; z-index:10">
<a style="color:#fff; border:none; text-decoration:none" 
title="Permanent Link to <?php the_title(); ?>" href="<?php the_permalink(); ?>"
 rel="bookmark"><?php the_title(); ?></a></h2>
</div>
</td></tr>

</table></div>

    <?php
        $key="show-video"; 
        if ( get_post_meta($post->ID, $key, true) !=    ) {             
    ?>
    <div class="video"><?php echo get_post_meta($post->ID, $key, true); ?></div>
    <script type="text/javascript">
        jQuery(document).ready(function() {
           jQuery("embed").attr("wmode", "transparent");
        });
    </script>       
    <?php
        } else if ( has_post_thumbnail() ) {
    ?>
    <a title="Permanent Link to <?php the_title(); ?>" 
                href="<?php the_permalink() ?>"><?php the_post_thumbnail(); ?></a>
    <?php } ?>
    </li>

<?php
endforeach;
?>      
</ul>
</div><!-- end home-gallery-wrapper -->

<script type="text/javascript">


function mycarousel_initCallback(carousel)
{
// Disable autoscrolling if the user clicks the prev or next button.
carousel.buttonNext.bind( click , function() {
    carousel.startAuto(0);
});

carousel.buttonPrev.bind( click , function() {
    carousel.startAuto(0);
});

// Pause autoscrolling if the user moves with the cursor over the clip.
carousel.clip.hover(function() {
    carousel.stopAuto();
}, function() {
    carousel.startAuto();
});
};


jQuery(document).ready(function() {
    jQuery( #home-gallery ).jcarousel({
        vertical: true,
        scroll: 1,
        easing:  easeInOutBack ,
             auto: 2,
             wrap:  last ,
             initCallback: mycarousel_initCallback,
            animation: 800
    });
});
</script>   
最佳回答

创建五种不同的旗帜,标有你们选择的颜色,标有1.png、旗帜2.png、旗帜3.png等。

然后改为

foreach($my_query as $post) :
    setup_postdata($post);
?>

<li style="width:910px"><div style="
background:url( <?php bloginfo( template_directory ); ?>/images/banner3.png ) 
center top no-repeat;">

With this

$i = 0;
foreach($my_query as $post) :
    setup_postdata($post);
?>

<li style="width:910px"><div style="
background:url( <?php bloginfo( template_directory ); ?>/images/banner<?php $i++; ?>.png ) 
center top no-repeat;">
问题回答

暂无回答




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签