English 中文(简体)
页: 1
原标题:wordpress: how to extract array of custom fields on a page

i 私人网页有一系列的习俗领域。 如果想做的话,就能够发现这些田地有多少被填满,然后根据田地的内容把一旁遮掩。 i 有一套可操作的法典,但总是特别针对这4个领域,如果那里没有任何东西,它就只是空洞。

在这里,《刑法》规定:

    <li class="sponsorSlot">
        <a href="<?php echo get_post_meta(158,  sponsor_01_uri , true); ?>" title="<?php echo get_post_meta(158,  sponsor_01_uriTitle , true); ?>">
        <img src="<?php bloginfo( stylesheet_directory ); ?>/<?php echo get_post_meta(158,  sponsor_01_image , true); ?>">
        </a>
    </li>       
    <li class="sponsorSlot">
        <a href="<?php echo get_post_meta(158,  sponsor_02_uri , true); ?>" title="<?php echo get_post_meta(158,  sponsor_02_uriTitle , true); ?>">
        <img src="<?php bloginfo( stylesheet_directory ); ?>/<?php echo get_post_meta(158,  sponsor_02_image , true); ?>">
        </a>
    </li>       
    <li class="sponsorSlot">
        <a href="<?php echo get_post_meta(158,  sponsor_03_uri , true); ?>" title="<?php echo get_post_meta(158,  sponsor_03_uriTitle , true); ?>">
        <img src="<?php bloginfo( stylesheet_directory ); ?>/<?php echo get_post_meta(158,  sponsor_03_image , true); ?>">
        </a>
    </li>       
    <li class="sponsorSlot">
        <a href="<?php echo get_post_meta(158,  sponsor_04_uri , true); ?>" title="<?php echo get_post_meta(158,  sponsor_04_uriTitle , true); ?>">
        <img src="<?php bloginfo( stylesheet_directory ); ?>/<?php echo get_post_meta(158,  sponsor_04_image , true); ?>">
        </a>
    </li>   

你们看看看一米试图做什么。 如果有1个或8个条目,就会发现有哪一个条目,而不必明确指明。 我的想法是建立一个阵列,然后是沿着阵列迈出的一步,以建设必要的要素。

感谢大家。

页: 1

最佳回答

您只能补充一种条件,以检查习俗领域的存在。

类似于

<?php  if((get_post_meta(158, "sponsor_01_uri", true)) || (get_post_meta($post->ID, "sponsor_01_uriTitle", true))) { ?>

是的,你可以通过获得——职位——梅塔(Metra)所退还的数值,但是,根据每份文件,你所具体说明的钥匙的所有价值,但你通过指定<代码><而予以否决。

问题回答

暂无回答




相关问题
Wrap stray text in <p> tags

Wordpress issue.. how do I wrap stray text in P tags? Example: Before- <div class = "content"> <img src = "hello.jpg"/> <h1>Introduction</h1> Hello! this is ...

Using jQuery Plugins with Wordpress

Having a bit of trouble using jQuery plugins (Superfish, jQuery UI, etc) using Wordpress. Everything works fine in my plain non-Wordpress site, but Wordpress seems to conflict with JQuery. There must ...

WordPress Data Storage Efficiency

I ve been asked to review a WordPress plugin of sorts and try to find ways of making it faster. The premise of this plugin is basically to store a bunch of users and shifts and appointments and ...

Why can t I properly style a blockquote in Wordpress?

On the design I just created for my website, I have a blockquote styled with two quote images using the span technique in css: blockquote { background-image: url(images/openquote.jpg); background-...

How does the WordPress <!--nextpage--> tag actually work?

What happens? I m guessing that somehow the post or page is parsed before displaying, and then just split into two methods? I can t seem to find any documentation on how the underlying <?php ...

Wordpress Plug-ins: How-to add custom URL Handles

I m trying to write a Wordpress Plug-in but can t seem to figure out how you would modify how a URL gets handled, so for example: any requests made for: <url>/?myplugin=<pageID> will ...

热门标签