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


PHP papi_get_field函数代码示例

本文整理汇总了PHP中papi_get_field函数的典型用法代码示例。如果您正苦于以下问题:PHP papi_get_field函数的具体用法?PHP papi_get_field怎么用?PHP papi_get_field使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: papi_get_term_field

/**
 * Get property value from the database.
 *
 * @param  int    $term_id
 * @param  string $slug
 * @param  mixed  $default
 *
 * @return mixed
 */
function papi_get_term_field($term_id = null, $slug = null, $default = null)
{
    if (!is_numeric($term_id) && is_string($term_id)) {
        $default = $slug;
        $slug = $term_id;
        $term_id = null;
    }
    if (!is_string($slug) || empty($slug)) {
        return $default;
    }
    return papi_get_field(papi_get_term_id($term_id), $slug, $default, 'term');
}
开发者ID:wp-papi,项目名称:papi,代码行数:21,代码来源:taxonomy.php

示例2: render_modules

 static function render_modules($property_slug)
 {
     $relations = papi_get_field($property_slug);
     if ($relations) {
         foreach ($relations as $key => $relation) {
             $blade_template = rtrim(papi_get_page_type_template($relation->ID), '.php');
             $view = view($blade_template, ['module' => papi_get_page($relation->ID)]);
             $pathToCompiled = $view->path;
             include $pathToCompiled;
         }
     }
 }
开发者ID:ekandreas,项目名称:orasolv-intra,代码行数:12,代码来源:papi.php

示例3: update_value

 /**
  * Update value.
  *
  * @param  Papi_Core_Property $property
  * @param  mixed  $value
  * @param  string $slug
  * @param  int    $post_id
  *
  * @return array
  */
 protected function update_value($property, $value, $slug, $post_id)
 {
     if (!is_array($value) || !$this->should_update_array($slug)) {
         return $property->import_value($value, $slug, $post_id);
     }
     $old = papi_get_field($post_id, $slug, []);
     $value = array_merge($old, $value);
     $value = $property->import_value($value, $slug, $post_id);
     if ($property->import_setting('property_array_slugs')) {
         return papi_from_property_array_slugs($value, $slug);
     }
     return $property->update_value($value, $slug, $post_id);
 }
开发者ID:ekandreas,项目名称:papi,代码行数:23,代码来源:class-papi-porter-driver-core.php

示例4: get_value

 /**
  * Get value.
  *
  * @return mixed
  */
 public function get_value()
 {
     $value = $this->get_option('value');
     if (papi_is_empty($value)) {
         $type = papi_get_meta_type();
         $slug = $this->get_slug(true);
         $value = papi_get_field($slug, null, $type);
         $post_status = get_post_status($this->get_post_id());
         if (papi_is_empty($value) && ($post_status === false || $post_status === 'auto-draft')) {
             $value = $this->get_option('default');
         }
     }
     if (papi_is_empty($value)) {
         return $this->default_value;
     }
     if ($this->convert_type === 'string') {
         $value = papi_convert_to_string($value);
     }
     return papi_santize_data($value);
 }
开发者ID:nlemoine,项目名称:papi,代码行数:25,代码来源:class-papi-property.php

示例5:

 * Try to get start page sidebar modules
 */
if (!sizeof($sidebar_modules)) {
    if ($frontpage_id = get_option('page_on_front')) {
        if ($frontpage_modules = papi_get_field($frontpage_id, 'sidebar')) {
            $sidebar_modules = $frontpage_modules;
        }
    }
}
?>

@if(sizeof($sidebar_modules))
	@foreach($sidebar_modules as $module)
        @if(Groups_Post_Access::user_can_read_post($module->ID))
            <?php 
if (papi_get_field($module->ID, 'anonymous_only') && is_user_logged_in()) {
    continue;
}
?>
    		<div class="row">
    			<?php 
$post = get_post($module->ID);
setup_postdata($GLOBALS['post'] =& $post);
bladerunner(rtrim(papi_get_page_type_template($module->ID), '.php'));
?>
                <p>&nbsp;</p>
    	    </div>
        @endif
	@endforeach
	<?php 
wp_reset_postdata();
开发者ID:lobbykit,项目名称:intra,代码行数:31,代码来源:sidebar.blade.php

示例6: export

 /**
  * Export data from Papi. With or without all property options.
  *
  * @param  mixed $post_id
  * @param  bool  $only_values
  *
  * @return array
  */
 public function export($post_id, $only_values = false)
 {
     $post_id = papi_get_post_id($post_id);
     if (empty($post_id)) {
         return [];
     }
     $slugs = papi_get_slugs($post_id);
     foreach ($slugs as $key => $box) {
         foreach ($box as $index => $slug) {
             unset($slugs[$key][$index]);
             $value = papi_get_field($post_id, $slug, null);
             if ($only_values === true) {
                 $slugs[$key][$slug] = $value;
             } else {
                 $store = papi_get_meta_store($post_id);
                 // @codeCoverageIgnoreStart
                 if (is_null($store)) {
                     continue;
                 }
                 // @codeCoverageIgnoreEnd
                 $property = $store->get_property($slug);
                 // @codeCoverageIgnoreStart
                 if (!papi_is_property($property)) {
                     continue;
                 }
                 // @codeCoverageIgnoreEnd
                 $options = clone $property->get_options();
                 $options->value = $value;
                 $slugs[$key][$slug] = $options;
             }
         }
     }
     return $slugs;
 }
开发者ID:wp-papi,项目名称:papi,代码行数:42,代码来源:class-papi-porter.php

示例7: papi_get_field

          <div class="startpageheaderend">{!! $module->thirdliner !!}</div>
          <p class="startpageherop">{{ $module->sellpoint }}</p>
          <div class="w-row startpageherorow">
            <div class="w-col w-col-6 w-col-small-6 w-clearfix">
              <?php 
$link = papi_get_field($module->id, 'link1');
?>
              @if( $link )
                <a href="{{ $link->url }}" class="w-inline-block startpageherobtn1">
                  <div class="startpageherobtn1text">{{ $link->title }}</div>
                </a>
              @endif
            </div>
            <div class="w-col w-col-6 w-col-small-6">
              <?php 
$link = papi_get_field($module->id, 'link2');
?>
              @if( $link )
                <a href="{{ $link->url }}" class="w-inline-block startpageherobtn2">
                  <div class="startpageherobtn1text startpageherobtn2text">{{ $link->title }}</div>
                </a>
              @endif
            </div>
          </div>
        </div>
        <div data-ix="scrollfingerback" class="startpageherofingerdiv"></div>
      </div>
    </div>
  </div>
  @include('views.parts.pointers.blue_right')
开发者ID:ekandreas,项目名称:aekab,代码行数:30,代码来源:homepage-hero.blade.php

示例8: papi_get_field

<?php

$image_field = papi_get_field('image');
$image = null;
$image = isset($image_field->sizes['small']) ? $image_field->sizes['small']['url'] : $image;
$image = isset($image_field->sizes['medium']) ? $image_field->sizes['medium']['url'] : $image;
$image = isset($image_field->sizes['large']) ? $image_field->sizes['large']['url'] : $image;
?>

  <div class="card">
<a href="<?php 
the_permalink();
?>
">
    <div class="card-image">
      <img src="<?php 
echo $image;
?>
" alt="<?php 
echo get_the_title();
?>
">
    </div>
    <div class="card-header">
      <?php 
echo get_the_title();
?>
    </div>
    <div class="card-copy">
      <p>
      <?php 
开发者ID:ekandreas,项目名称:nordiciron,代码行数:31,代码来源:product-card.php

示例9: get_header

<?php

get_header();
while (have_posts()) {
    the_post();
    ?>

<div class="entry">
	<?php 
    the_title('<h1 class="entry-title">', '</h1>');
    ?>

	<?php 
    $hero = papi_get_field('hero_image');
    if ($hero) {
        ?>
			<div class="entry-hero">
				<img src="<?php 
        echo $hero->url;
        ?>
" />
			</div>
			<?php 
    }
    ?>

	<div class="entry-text">
		<?php 
    the_papi_field('editor');
    ?>
	</div>
开发者ID:rasmusbe,项目名称:dev-theme,代码行数:31,代码来源:article-page.php

示例10: restore_post_revision

 /**
  * Restore to post revision.
  *
  * @param int $post_id
  * @param int $revision_id
  */
 public function restore_post_revision($post_id, $revision_id)
 {
     $slugs = papi_get_slugs($revision_id, true);
     foreach ($slugs as $slug) {
         $value = papi_get_field($revision_id, $slug);
         if (papi_is_empty($value)) {
             papi_delete_field($post_id, $slug);
         } else {
             papi_update_field($post_id, $slug, $value);
         }
     }
 }
开发者ID:wp-papi,项目名称:papi,代码行数:18,代码来源:class-papi-admin-meta-handler.php

示例11: html

    /**
     * Render property html.
     */
    public function html()
    {
        $post_id = papi_get_post_id();
        $settings = $this->get_settings();
        // Create query array for every page type.
        $page_types = array_map(function ($page_type) {
            return ['key' => papi_get_page_type_key(), 'value' => $page_type, 'compare' => 'LIKE'];
        }, papi_to_array($settings->page_type));
        // Add relation.
        $page_types['relation'] = 'OR';
        // Prepare arguments for WP_Query.
        $args = ['post_type' => 'any', 'no_found_rows' => true, 'update_post_meta_cache' => false, 'update_post_term_cache' => false, 'meta_query' => $page_types];
        $query = new WP_Query($args);
        $posts = $query->get_posts();
        $values = [];
        foreach (papi_to_array($settings->slug) as $slug) {
            foreach ($posts as $post) {
                $val = papi_get_field($post->ID, $slug);
                $val = array_filter(papi_to_array($val), function ($item) use($post_id) {
                    return is_object($item) && $item->ID === $post_id;
                });
                if (empty($val)) {
                    continue;
                }
                $page_type = papi_get_entry_type_by_meta_id($post->ID);
                if (empty($page_type)) {
                    continue;
                }
                // Create the array
                if (!isset($values[$post->post_type])) {
                    $values[$post->post_type] = [];
                }
                if (!isset($values[$post->post_type][$page_type->name])) {
                    $values[$post->post_type][$page_type->name] = [];
                }
                // Add the post
                if (!isset($values[$post->post_type][$page_type->name][$post->ID]) && !empty($val)) {
                    $values[$post->post_type][$page_type->name][$post->ID] = $post;
                }
            }
        }
        ?>
		<ul class="papi-property-reference" data-papi-rule="<?php 
        echo esc_attr($this->html_name());
        ?>
">
			<?php 
        if (empty($values)) {
            ?>
				<p>
					<?php 
            esc_html_e('No references exists', 'papi');
            ?>
				</p>
			<?php 
        }
        ksort($values);
        foreach ($values as $title => $val) {
            $post_type = get_post_type_object($title);
            ?>
				<li>
					<h3><?php 
            echo esc_html($post_type->labels->name);
            ?>
</h3>
					<div class="handlediv" title="Click to toggle"><br></div>
				</li>
				<li>
					<div class="page-types">
						<ul>
							<?php 
            ksort($val);
            foreach ($val as $name => $posts) {
                ?>
								<li class="heading-border">
									<h4><?php 
                echo esc_html($name);
                ?>
</h4>
									<div class="handlediv" title="Click to toggle"><br></div>
								</li>
								<li>
									<div class="box">
										<?php 
                $i = 0;
                foreach ($posts as $post) {
                    ?>
											<a href="<?php 
                    echo esc_attr(get_edit_post_link($post->ID));
                    ?>
"><?php 
                    echo esc_html($post->post_title);
                    ?>
</a>
										<?php 
                    $i++;
                }
//.........这里部分代码省略.........
开发者ID:nlemoine,项目名称:papi,代码行数:101,代码来源:class-papi-property-reference.php

示例12: papi_get_option

/**
 * Get property value for property on a option page.
 *
 * @param  string $slug
 * @param  mixed  $default
 *
 * @return mixed
 */
function papi_get_option($slug, $default = null)
{
    return papi_get_field(0, $slug, $default, Papi_Option_Page::TYPE);
}
开发者ID:ekandreas,项目名称:papi,代码行数:12,代码来源:option.php

示例13: while

<div class="wrap">
	<div id="primary" class="content-home">
		<main id="main" class="site-main" role="main">

			<?php 
while (have_posts()) {
    the_post();
    ?>

				<?php 
    get_template_part('template-parts/content', 'home');
    ?>

                <?php 
    $products = papi_get_field('products');
    if ($products) {
        ?>
					<div class="cards">
                	<?php 
        foreach ($products as $key => $product) {
            $post = get_post($product->ID);
            setup_postdata($post);
            get_template_part('templates/parts/product-card');
        }
        ?>
					</div>
                	<?php 
    }
    wp_reset_postdata();
    ?>
开发者ID:ekandreas,项目名称:nordiciron,代码行数:30,代码来源:template-homepage.php

示例14: papi_get_option

/**
 * Get property value for property on a option page.
 *
 * @param  string $slug
 * @param  mixed  $default
 *
 * @return mixed
 */
function papi_get_option($slug, $default = null)
{
    return papi_get_field(0, $slug, $default, 'option');
}
开发者ID:wp-papi,项目名称:papi,代码行数:12,代码来源:option.php

示例15: papi_get_option

/**
 * Get property value for property on a option page.
 *
 * @param  string $slug
 * @param  mixed  $default
 *
 * @return mixed
 */
function papi_get_option($slug, $default = null)
{
    return papi_get_field(0, $slug, $default, Papi_Core_Page::TYPE_OPTION);
}
开发者ID:KristoferN,项目名称:papi,代码行数:12,代码来源:option.php


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