当前位置: 首页>>代码示例>>PHP>>正文


PHP Option::get_structure方法代码示例

本文整理汇总了PHP中Option::get_structure方法的典型用法代码示例。如果您正苦于以下问题:PHP Option::get_structure方法的具体用法?PHP Option::get_structure怎么用?PHP Option::get_structure使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Option的用法示例。


在下文中一共展示了Option::get_structure方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: post_type_link

 /**
  *
  * Fix post_type permalink from postname to id.
  *
  * @param string $post_link The post's permalink.
  * @param \WP_Post $post The post in question.
  *
  * @return string
  */
 public function post_type_link($post_link, \WP_Post $post)
 {
     if (!$this->option->get_structure($post->post_type)) {
         return $post_link;
     }
     $rewritecode = array("%{$post->post_type}_id%");
     $rewritereplace = array($post->ID);
     return str_replace($rewritecode, $rewritereplace, $post_link);
 }
开发者ID:jaws-ug,项目名称:jawsdays2016,代码行数:18,代码来源:Permalink.php

示例2: reset_rewrite_rule

 /**
  *
  * set default permastruct.
  * for deactivation.
  *
  * @param array $param
  *
  */
 public function reset_rewrite_rule($param)
 {
     $args = $param['args'];
     $post_type = $param['post_type'];
     $permastruct_args = $args->rewrite;
     $permastruct_args['feed'] = $permastruct_args['feeds'];
     if ($this->option->get_structure($post_type)) {
         add_permastruct($post_type, "{$args->rewrite['slug']}/%{$post_type}%", $permastruct_args);
     }
 }
开发者ID:jaws-ug,项目名称:jawsdays2016,代码行数:18,代码来源:Rewrite.php

示例3: setting_field

    /**
     *
     * setting field row.
     *
     * @param $args
     */
    public function setting_field($args)
    {
        global $wp_rewrite;
        $slash = '';
        if ($wp_rewrite->use_trailing_slashes) {
            $slash = '/';
        }
        preg_match('/sptp_(.+)_structure/', $args, $matches);
        $post_type = $matches[1];
        $post_type_object = get_post_type_object($post_type);
        $with_front = $post_type_object->rewrite['with_front'];
        $slug = trim($post_type_object->rewrite['slug'], '/');
        if (!empty($post_type_object->rewrite['original_slug'])) {
            $slug = trim($post_type_object->rewrite['original_slug'], '/');
        }
        $values = array(false, "{$slug}/%post_id%", "{$slug}/%postname%.html", "{$slug}/%post_id%.html");
        $permastruct = $this->option->get_structure($post_type);
        $disabled = $this->option->is_defined_structure($post_type);
        ?>
		<fieldset class="sptp-fieldset <?php 
        echo $with_front ? 'with-front' : '';
        ?>
">
			<?php 
        $checked = false;
        foreach ($values as $value) {
            if (!$checked) {
                $checked = $permastruct == $value;
            }
            $permalink = str_replace(array('%postname%', '%post_id%'), array('sample-post', '123'), $value);
            ?>
				<label>
					<input type="radio" name="<?php 
            echo esc_attr($args);
            ?>
_select"
					       value="<?php 
            echo esc_attr($value);
            ?>
"
						<?php 
            if (!$disabled) {
                checked($permastruct, $value);
            }
            ?>
						<?php 
            disabled($disabled);
            ?>
						/>
					<?php 
            if ($value) {
                ?>
						<code><?php 
                echo esc_html(home_url()) . '/' . $this->create_permastruct($permalink, $with_front);
                ?>
							<span
								class="slash"><?php 
                echo esc_attr($slash);
                ?>
</span></code>
					<?php 
            } else {
                ?>
						Default.
					<?php 
            }
            ?>

				</label>
				<br/>
			<?php 
        }
        ?>
			<label>
				<input type="radio" name="<?php 
        echo esc_attr($args);
        ?>
_select" value="custom"
					<?php 
        checked($checked, false);
        ?>
					<?php 
        disabled($disabled);
        ?>
 />
				<code><?php 
        echo esc_html(home_url()) . '/' . $this->create_permastruct('', $with_front);
        ?>
</code>

				<input class="regular-text code"
				       name="<?php 
        echo esc_attr("sptp_{$post_type}_structure");
        ?>
//.........这里部分代码省略.........
开发者ID:jaws-ug,项目名称:jawsdays2016,代码行数:101,代码来源:Admin.php


注:本文中的Option::get_structure方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。