• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP papi_get_field函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: papi_get_page_type_id

            <div class="blogpuffright">
              <div class="w-clearfix blogpuffheaderdiv">
                <div class="blogpuffheaderleft">

                  @if( papi_get_page_type_id() == 'blog-post' )
                        <div class="blogpuffdate">{{ __('BLOGGPOST','AEKAB' ) }}</div>
                  @elseif( papi_get_page_type_id() == 'portfolio-post' )
                        <div class="blogpuffdate">{{ __('UPPDRAG','AEKAB' ) }}</div>
                  @else
                        <div class="blogpuffdate">{{ __('NYHET','AEKAB' ) }}</div>
                  @endif

                </div>
                <div class="blogpuffheaderright">
                  <?php 
$main_cat = papi_get_field('main_category');
?>
                  @if( $main_cat && property_exists( $main_cat, 'name' ) )
                    <div class="blogpuffheadertxt">{{ $main_cat->name }}</div>
                  @endif
                </div>
              </div>
              <a href="{{ get_the_permalink() }}" class="w-inline-block blogpuffclickarea"><h3 class="blogpuffheadline">{{the_title()}}</h3>
                <p class="blogpuffbody">
                  {!! get_post_excerpt() !!}                
                </p>
              </a>
            </div>
          </div> 

开发者ID:ekandreas,项目名称:aekab,代码行数:29,代码来源:pusher.blade.php


示例17: wp_reset_postdata

            @endforeach
          @endif

          <?php 
wp_reset_postdata();
?>
            

        </div>
      </div>
    </div>
  </div>
  <div class="w-section sectionpuffsmorenews">
    <div class="w-container">
      <?php 
$more = papi_get_field($module->id, 'more');
?>
      @if( $more )
      <a href="{{ $more->url }}" class="w-inline-block startpagelinkblockmorenews">
        <div>{{ $more->title }}</div>
      </a>
      @endif
    </div>
  </div>
  @include('views.parts.swisch')

@include('views.parts.admin-edit')


开发者ID:ekandreas,项目名称:aekab,代码行数:27,代码来源:homepage-pusher.blade.php


示例18: papi_get_field

<?php

$type = 1;
$payoff = 'Ledord för oss är respons, nyfikenhet, affärsförståelse och kvalitetsinsatser.';
if (isset($module)) {
    $type = $module->type;
    $payoff = $module->words;
} else {
    $post_payoff = papi_get_field('payoff');
    if ($post_payoff) {
        $payoff = $post_payoff;
    }
    $type = 2;
}
?>


@if( $type == 2 )
	<div class="w-section sectiongreypayoff">
		<div class="w-container">
			<h2 class="startpagepayoff1 payoff2">{{ $payoff }}</h2>
		</div>
	</div>
	@include('views.parts.pointers.gray_right')
@else
	<div class="w-section startpagesectionpayoff1">
		<div class="w-container">
			<h1 class="startpagepayoff1">{{ $payoff }}</h1>
		</div>
	</div>
@endif
开发者ID:ekandreas,项目名称:aekab,代码行数:31,代码来源:payoff.blade.php


示例19: papi_get_field

$matches = papi_get_field($module->id, 'matches');
if ($matches) {
    foreach ($matches as $match) {
        if (!$cat_list == '') {
            $cat_list .= ',';
        }
        $cat_list .= $match['term']->term_id;
    }
}
?>
<div class="row">

	<div class="col-md-12">

		<?php 
$length = (int) papi_get_field($module->id, 'excerpt_length');
$args = ['post_type' => 'post'];
if ($cat_list != '') {
    $args['cat'] = $cat_list;
}
$the_query = new WP_Query($args);
?>
		@if( $the_query->have_posts() )
			@if( $title=papi_get_field( $module->id, 'title' ) )
				<h2>{{ $title }}</h2>
			@endif
			@while ( $the_query->have_posts() )
				{{ $the_query->the_post() }}
					<h3>{{ the_title() }}</h3>
					{!! get_post_excerpt( get_the_ID(), $length, false) !!}
					<br/>
开发者ID:ekandreas,项目名称:orasolv-intra,代码行数:31,代码来源:blogroll.blade.php


示例20: get_value

 /**
  * Get property value.
  *
  * @param  Papi_Core_Conditional_Rule $rule
  *
  * @return mixed
  */
 private function get_value(Papi_Core_Conditional_Rule $rule)
 {
     if (papi_doing_ajax()) {
         $source = $rule->get_source();
         $meta_id = papi_get_meta_id();
         $entry_type = papi_get_entry_type_by_meta_id($meta_id);
         if (!papi_is_empty($source) && $entry_type instanceof Papi_Entry_Type !== false) {
             if (papi_is_property($entry_type->get_property($rule->slug))) {
                 return $this->get_deep_value($rule->slug, $source);
             }
         }
     }
     if (!papi_is_empty($rule->get_source())) {
         return $this->get_deep_value($rule->slug, $rule->get_source());
     }
     $slug = $rule->get_field_slug();
     $type = papi_get_meta_type();
     $value = papi_get_field($slug, null, $type);
     return $this->get_deep_value($slug, $value);
 }
开发者ID:nlemoine,项目名称:papi,代码行数:27,代码来源:class-papi-conditional-rules.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP papi_get_post_id函数代码示例发布时间:2022-05-15
下一篇:
PHP panther_link函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap