WordPress主题选项页面创建一个选择列表(下拉列表)?

如何使用<select>在我的WordPress主题选项页面中创建包含3个选项的选择列表?我以前从未做过。我尝试了这个:

<p>
    <select name="wordpress_theme_options[background-position-x]" size="3">
      <option>Left</option>
      <option>Center</option>
      <option>Right</option>
    </select>
    <select name="wordpress_theme_options[background-position-y]" size="3">
      <option>Top</option>
      <option>Center</option>
      <option>Bottom</option>
    </select>
</p>

但是我没有下拉菜单, 它看起来令人毛骨悚然, 并且不会保存所选的值。


#1


我发现了(另一个示例):

<p>
    <select name="wordpress_theme_options[slider-posts]" value="<?php esc_attr_e( $options['slider-posts'] ); ?>">
      <option value="value1" <?php selected( 'value1' == $options['slider-posts'] ); ?>>1</option>
      <option value="value2" <?php selected( 'value2' == $options['slider-posts'] ); ?>>2</option>
      <option value="value3" <?php selected( 'value3' == $options['slider-posts'] ); ?>>3</option>
      <option value="value4" <?php selected( 'value4' == $options['slider-posts'] ); ?>>4</option>
      <option value="value5" <?php selected( 'value5' == $options['slider-posts'] ); ?>>5</option>
    </select>
</p>

来源:

https://www.srcmini02.com/66780.html

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_37019.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?