本文整理汇总了PHP中genesis_get_custom_field函数的典型用法代码示例。如果您正苦于以下问题:PHP genesis_get_custom_field函数的具体用法?PHP genesis_get_custom_field怎么用?PHP genesis_get_custom_field使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了genesis_get_custom_field函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: genesis_page_templates_post_meta
/**
* Genesis Page Templates custom loop post meta control.
*
* @since 1.0.1
*/
function genesis_page_templates_post_meta()
{
$gcl_post_meta = esc_attr(genesis_get_custom_field('_gcl_post_meta'));
if ('no' == $gcl_post_meta) {
remove_action('genesis_entry_footer', 'genesis_post_meta');
}
}
开发者ID:bradpotter,项目名称:genesis-page-templates,代码行数:12,代码来源:gpt-custom-loop.php
示例2: gs_inpost_scripts_box
/**
* Callback for in-post scripts meta box.
*
* Echoes out HTML.
*
* @category Genesis
* @package Admin
* @subpackage Inpost-Metaboxes
*
*/
function gs_inpost_scripts_box()
{
wp_nonce_field('gs_inpost_scripts_save', 'gs_inpost_scripts_nonce');
?>
<p><label for="genesis_redirect"><b><?php
_e('Custom Redirect URI', 'genesis');
?>
</b> <a href="http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=93633" target="_blank" title="301 Redirect">[?]</a></label></p>
<p><input class="large-text" type="text" name="genesis_scripts[redirect]" id="genesis_redirect" value="<?php
echo esc_url(genesis_get_custom_field('redirect'));
?>
" /></p>
<p><label for="genesis_header_scripts"><b><?php
_e('Scripts', 'genesis');
?>
</b></label></p>
<p><textarea class="large-text" rows="4" cols="6" name="genesis_scripts[_genesis_scripts]" id="genesis_header_scripts"><?php
echo esc_textarea(genesis_get_custom_field('_genesis_scripts'));
?>
</textarea></p>
<p><label for="genesis_footer_scripts"><b><?php
_e('Footer Scripts', 'genesis');
?>
</b></label></p>
<p><textarea class="large-text" rows="4" cols="6" name="genesis_scripts[_genesis_footer_scripts]" id="genesis_footer_scripts"><?php
echo esc_textarea(genesis_get_custom_field('_genesis_footer_scripts'));
?>
</textarea></p>
<?php
}
开发者ID:freezvd,项目名称:Genesis-Sandbox,代码行数:43,代码来源:gs-inpost-functions.php
示例3: gs_footer_scripts
/**
* Echo footer scripts in to wp_footer().
*
* Allows shortcodes.
*
* Applies genesis_header_scripts on value stored in header_scripts setting.
*
* Also echoes scripts from the post's custom field.
*
* @since 1.0.0
*
* @uses genesis_get_option() Get theme setting value
* @uses genesis_get_custom_field() Echo custom field value
*/
function gs_footer_scripts()
{
/** If singular, echo scripts from custom field */
if (is_singular() && genesis_get_custom_field('_genesis_footer_scripts')) {
genesis_custom_field('_genesis_footer_scripts');
}
}
开发者ID:freezvd,项目名称:Genesis-Sandbox,代码行数:21,代码来源:gs-functions.php
示例4: genesis_custom_body_class
/**
* Adds custom field body class(es) to the body classes.
*
* It accepts values from a per-post / page custom field, and only outputs when
* viewing a singular page.
*
* @since 1.4.0
*
* @uses genesis_get_custom_field() Get custom field value
*
* @param array $classes Existing classes
* @return array Amended classes
*/
function genesis_custom_body_class($classes)
{
$new_class = is_singular() ? genesis_get_custom_field('_genesis_custom_body_class') : null;
if ($new_class) {
$classes[] = esc_attr(sanitize_html_class($new_class));
}
return $classes;
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:21,代码来源:layout.php
示例5: genesis_custom_post_class
/**
* Adds a custom post class based on the value stored as a custom field.
*
* @since 1.4.0
*
* @uses genesis_get_custom_field() Get custom field value
*
* @param array $classes Existing post classes
* @return array Amended post classes
*/
function genesis_custom_post_class($classes)
{
$new_class = genesis_get_custom_field('_genesis_custom_post_class');
if ($new_class) {
$classes[] = esc_attr(sanitize_html_class($new_class));
}
return $classes;
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:18,代码来源:post.php
示例6: genesis_custom_body_class
/**
* Add custom field body class(es) to the body classes.
*
* It accepts values from a per-post or per-page custom field, and only outputs when viewing a singular page.
*
* @since 1.4.0
*
* @uses genesis_get_custom_field() Get custom field value.
*
* @param array $classes Existing classes.
*
* @return array Amended classes.
*/
function genesis_custom_body_class(array $classes)
{
$new_class = is_singular() ? genesis_get_custom_field('_genesis_custom_body_class') : null;
if ($new_class) {
$classes[] = esc_attr($new_class);
}
return $classes;
}
开发者ID:treydonovan,项目名称:innergame-anna,代码行数:21,代码来源:layout.php
示例7: get_custom_field
/**
* @deprecated in 0.1.3
*
**/
function get_custom_field($field, $echo = TRUE)
{
if ($echo) {
genesis_custom_field($field);
} else {
return genesis_get_custom_field($field);
}
}
开发者ID:Weissenberger13,项目名称:web.portugalrentalcottages,代码行数:12,代码来源:deprecated_functions.php
示例8: sk_masonry_loop
/**
* Outputs a custom loop
*
* @global mixed $paged current page number if paginated
* @return void
*/
function sk_masonry_loop()
{
$include = genesis_get_option('blog_cat');
$exclude = genesis_get_option('blog_cat_exclude') ? explode(',', str_replace(' ', '', genesis_get_option('blog_cat_exclude'))) : '';
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
//* Easter Egg
$query_args = wp_parse_args(genesis_get_custom_field('query_args'), array('cat' => $include, 'category__not_in' => $exclude, 'showposts' => genesis_get_option('blog_cat_num'), 'paged' => $paged));
genesis_custom_loop($query_args);
}
开发者ID:ngo6012,项目名称:socratic-genesis-starter-theme,代码行数:15,代码来源:page-masonry.php
示例9: widget
function widget($args, $instance)
{
/** defaults */
$instance = wp_parse_args($instance, array('title' => '', 'posts_per_page' => 10));
extract($args);
echo $before_widget;
if (!empty($instance['title'])) {
echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
}
$toggle = '';
/** for left/right class */
$query_args = array('post_type' => 'listing', 'posts_per_page' => $instance['posts_per_page'], 'paged' => get_query_var('paged') ? get_query_var('paged') : 1);
query_posts($query_args);
if (have_posts()) {
while (have_posts()) {
the_post();
//* initialze the $loop variable
$loop = '';
//* Pull all the listing information
$custom_text = genesis_get_custom_field('_listing_text');
$price = genesis_get_custom_field('_listing_price');
$address = genesis_get_custom_field('_listing_address');
$city = genesis_get_custom_field('_listing_city');
$state = genesis_get_custom_field('_listing_state');
$zip = genesis_get_custom_field('_listing_zip');
$loop .= sprintf('<a href="%s">%s</a>', get_permalink(), genesis_get_image(array('size' => 'properties')));
if ($price) {
$loop .= sprintf('<span class="listing-price">%s</span>', $price);
}
if (strlen($custom_text)) {
$loop .= sprintf('<span class="listing-text">%s</span>', esc_html($custom_text));
}
if ($address) {
$loop .= sprintf('<span class="listing-address">%s</span>', $address);
}
if ($city || $state || $zip) {
//* count number of completed fields
$pass = count(array_filter(array($city, $state, $zip)));
//* If only 1 field filled out, no comma
if (1 == $pass) {
$city_state_zip = $city . $state . $zip;
} elseif ($city) {
$city_state_zip = $city . ", " . $state . " " . $zip;
} else {
$city_state_zip = $city . " " . $state . ", " . $zip;
}
$loop .= sprintf('<span class="listing-city-state-zip">%s</span>', trim($city_state_zip));
}
$loop .= sprintf('<a href="%s" class="more-link">%s</a>', get_permalink(), __('View Listing', 'agentpress-listings'));
$toggle = $toggle == 'left' ? 'right' : 'left';
/** wrap in post class div, and output **/
printf('<div class="%s"><div class="widget-wrap"><div class="listing-wrap">%s</div></div></div>', join(' ', get_post_class($toggle)), apply_filters('agentpress_featured_listings_widget_loop', $loop));
}
}
wp_reset_query();
echo $after_widget;
}
开发者ID:kabrewer07,项目名称:mrw,代码行数:57,代码来源:class-featured-listings-widget.php
示例10: ss_inpost_metabox
function ss_inpost_metabox()
{
$_sidebars = stripslashes_deep(get_option(SS_SETTINGS_FIELD));
global $wp_registered_sidebars;
?>
<input type="hidden" name="ss_inpost_nonce" value="<?php
echo wp_create_nonce(plugin_basename(__FILE__));
?>
" />
<?php
if (isset($wp_registered_sidebars['sidebar'])) {
?>
<p>
<label class="howto" for="_ss_sidebar"><span><?php
echo esc_attr($wp_registered_sidebars['sidebar']['name']);
?>
<span></label>
<select name="_ss_sidebar" id="_ss_sidebar" style="width: 99%">
<option value=""><?php
_e('Default', 'genesis-simple-sidebars');
?>
</option>
<?php
foreach ((array) $_sidebars as $id => $info) {
printf('<option value="%s" %s>%s</option>', esc_html($id), selected($id, genesis_get_custom_field('_ss_sidebar'), false), esc_html($info['name']));
}
?>
</select>
</p>
<?php
}
if (isset($wp_registered_sidebars['sidebar-alt'])) {
?>
<p>
<label class="howto" for="_ss_sidebar_alt"><span><?php
echo esc_attr($wp_registered_sidebars['sidebar-alt']['name']);
?>
<span></label>
<select name="_ss_sidebar_alt" id="_ss_sidebar_alt" style="width: 99%">
<option value=""><?php
_e('Default', 'genesis-simple-sidebars');
?>
</option>
<?php
foreach ((array) $_sidebars as $id => $info) {
printf('<option value="%s" %s>%s</option>', esc_html($id), selected($id, genesis_get_custom_field('_ss_sidebar_alt'), false), esc_html($info['name']));
}
?>
</select>
</p>
<?php
}
}
开发者ID:tleonard2,项目名称:durablegbFeb,代码行数:57,代码来源:inpost.php
示例11: genesis_custom_field_redirect
/**
* Redirect singular page to an alternate URL.
*
*/
function genesis_custom_field_redirect()
{
if (!is_singular()) {
return;
}
if ($url = genesis_get_custom_field('redirect')) {
wp_redirect(esc_url_raw($url), 301);
exit;
}
}
开发者ID:treydonovan,项目名称:innergame-anna,代码行数:14,代码来源:general.php
示例12: portfolio_loop
function portfolio_loop()
{
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
$include = genesis_get_option('crystal_portfolio_cat');
$exclude = genesis_get_option('crystal_portfolio_cat_exclude') ? explode(',', str_replace(' ', '', genesis_get_option('crystal_portfolio_cat_exclude'))) : '';
$cf = genesis_get_custom_field('query_args');
// Easter Egg
$args = array('cat' => $include, 'category__not_in' => $exclude, 'showposts' => genesis_get_option('crystal_portfolio_cat_num'), 'paged' => $paged);
$query_args = wp_parse_args($cf, $args);
genesis_custom_loop($query_args);
}
开发者ID:nmrugg,项目名称:studiopress-premum-wp-themes,代码行数:11,代码来源:page_portfolio.php
示例13: ss_inpost_metabox
function ss_inpost_metabox()
{
$_sidebars = stripslashes_deep(get_option(SS_SETTINGS_FIELD));
?>
<input type="hidden" name="ss_inpost_nonce" value="<?php
echo wp_create_nonce(plugin_basename(__FILE__));
?>
" />
<p>
<label class="howto" for="_ss_sidebar"><span><?php
_e('Primary Sidebar', 'ss');
?>
<span></label>
<select name="_ss_sidebar" id="_ss_sidebar" style="width: 99%">
<option value=""><?php
_e('Default', 'ss');
?>
</option>
<?php
foreach ((array) $_sidebars as $id => $info) {
printf('<option value="%s" %s>%s</option>', esc_html($id), selected($id, genesis_get_custom_field('_ss_sidebar'), false), esc_html($info['name']));
}
?>
</select>
</p>
<?php
// don't show the option if there are no 3 column layouts registered
if (!ss_has_3_column_layouts()) {
return;
}
?>
<p>
<label class="howto" for="_ss_sidebar_alt"><span><?php
_e('Secondary Sidebar', 'ss');
?>
<span></label>
<select name="_ss_sidebar_alt" id="_ss_sidebar_alt" style="width: 99%">
<option value=""><?php
_e('Default', 'ss');
?>
</option>
<?php
foreach ((array) $_sidebars as $id => $info) {
printf('<option value="%s" %s>%s</option>', esc_html($id), selected($id, genesis_get_custom_field('_ss_sidebar_alt'), false), esc_html($info['name']));
}
?>
</select>
</p>
<?php
}
开发者ID:hscale,项目名称:webento,代码行数:53,代码来源:inpost.php
示例14: genesis_do_loop
/**
* Attach a loop to the genesis_loop output hook so we can get
* some front-end output. Pretty basic stuff.
*
* @since 1.1.0
*
* @uses genesis_get_option() Get theme setting value
* @uses genesis_get_custom_field() Get custom field value
* @uses genesis_custom_loop() Do custom loop
* @uses genesis_standard_loop() Do standard loop
*/
function genesis_do_loop()
{
if (is_page_template('page_blog.php')) {
$include = genesis_get_option('blog_cat');
$exclude = genesis_get_option('blog_cat_exclude') ? explode(',', str_replace(' ', '', genesis_get_option('blog_cat_exclude'))) : '';
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
/** Easter Egg */
$query_args = wp_parse_args(genesis_get_custom_field('query_args'), array('cat' => $include, 'category__not_in' => $exclude, 'showposts' => genesis_get_option('blog_cat_num'), 'paged' => $paged));
genesis_custom_loop($query_args);
} else {
genesis_standard_loop();
}
}
开发者ID:hscale,项目名称:webento,代码行数:24,代码来源:loops.php
示例15: agentpress_featured_listings_widget_loop_filter
/**
* Filter the loop output of the AgentPress Featured Listings Widget.
*
*/
function agentpress_featured_listings_widget_loop_filter($loop)
{
$loop = '';
/** initialze the $loop variable */
$loop .= sprintf('<a href="%s">%s</a>', get_permalink(), genesis_get_image(array('size' => 'properties')));
$loop .= sprintf('<span class="listing-price">%s</span>', genesis_get_custom_field('_listing_price'));
$custom_text = genesis_get_custom_field('_listing_text');
if (strlen($custom_text)) {
$loop .= sprintf('<span class="listing-text">%s</span>', esc_html($custom_text));
}
$loop .= sprintf('<span class="listing-address">%s</span>', genesis_get_custom_field('_listing_address'));
$loop .= sprintf('<span class="listing-city-state-zip">%s %s, %s</span>', genesis_get_custom_field('_listing_city'), genesis_get_custom_field('_listing_state'), genesis_get_custom_field('_listing_zip'));
$loop .= sprintf('<a href="%s" class="more-link">%s</a>', get_permalink(), __('View Listing', 'apl'));
return $loop;
}
开发者ID:kabrewer07,项目名称:mrw,代码行数:19,代码来源:functions.php
示例16: genesis_page_templates_custom_loop
/**
* Genesis Page Templates Custom Loop.
*
* @since 1.0.1
*/
function genesis_page_templates_custom_loop()
{
$gcl_post_type = esc_attr(genesis_get_custom_field('_gcl_post_type'));
$gcl_taxonomy = esc_attr(genesis_get_custom_field('_gcl_taxonomy'));
$gcl_tax_term = esc_attr(genesis_get_custom_field('_gcl_tax_term'));
$gcl_posts_per_page = esc_attr(genesis_get_custom_field('_gcl_posts_per_page'));
$gcl_order_by = esc_attr(genesis_get_custom_field('_gcl_order_by'));
$gcl_order = esc_attr(genesis_get_custom_field('_gcl_order'));
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
$query_args = wp_parse_args(array('post_type' => $gcl_post_type, 'posts_per_page' => $gcl_posts_per_page, 'orderby' => $gcl_order_by, 'order' => $gcl_order, 'paged' => $paged));
if (!empty($gcl_tax_term)) {
$terms = empty($gcl_tax_term) ? get_terms($gcl_taxonomy) : $gcl_tax_term;
$args['tax_query'] = array(array('taxonomy' => $gcl_taxonomy, 'field' => 'slug', 'terms' => $terms));
}
genesis_custom_loop($query_args);
}
开发者ID:robneu,项目名称:genesis-page-templates,代码行数:21,代码来源:gpt-custom-loop.php
示例17: sax_set_background_color
function sax_set_background_color()
{
?>
<style>
.page.altitude-landing {background-color: <?php
echo genesis_get_custom_field('wpcf-background-main-color');
?>
; }
.page.altitude-landing .fake-sidebar{background-color: <?php
echo genesis_get_custom_field('wpcf-background-main-color');
?>
; }
.page.altitude-landing .fake-sidebar {color: <?php
echo genesis_get_custom_field('wpcf-cta-text-color');
?>
; }
</style>
<?php
}
开发者ID:saxisme,项目名称:altitude-pro,代码行数:19,代码来源:page_landing_form_sidebar.php
示例18: discovery_listing_archive_loop
/**
* Custom loop for listing archive page
*/
function discovery_listing_archive_loop()
{
$toggle = '';
if (have_posts()) {
while (have_posts()) {
the_post();
$loop = '';
// init
$loop .= sprintf('<a href="%s">%s</a>', get_permalink(), genesis_get_image(array('size' => 'properties')));
$loop .= sprintf('<span class="listing-price">%s</span>', genesis_get_custom_field('_listing_price'));
$loop .= sprintf('<span class="listing-text">%s</span>', genesis_get_custom_field('_listing_text'));
$loop .= sprintf('<span class="listing-address">%s</span>', genesis_get_custom_field('_listing_address'));
$loop .= sprintf('<span class="listing-city-state-zip">%s, %s %s</span>', genesis_get_custom_field('_listing_city'), genesis_get_custom_field('_listing_state'), genesis_get_custom_field('_listing_zip'));
$loop .= sprintf('<a href="%s" class="more-link">%s</a>', get_permalink(), __('View Listing', 'discovery'));
$toggle = $toggle == 'left' ? 'right' : 'left';
/** wrap in post class div, and output **/
printf('<div class="%s"><div class="widget-wrap"><div class="listing-wrap">%s</div></div></div>', join(' ', get_post_class($toggle)), $loop);
}
}
}
开发者ID:kabrewer07,项目名称:mrw,代码行数:23,代码来源:archive-listing.php
示例19: custom_do_loop
function custom_do_loop()
{
// Intro Text (from page content)
echo '<div class="archive-description">';
echo '<h1 class="archive-title" style="text-align:center;">TSL360 Archive</h1>';
echo '</div>';
global $post;
// arguments, adjust as needed
$args = wp_parse_args(genesis_get_custom_field('query_args'), array('post_type' => 'post', 'posts_per_page' => 18, 'post_status' => 'publish', 'paged' => get_query_var('paged')));
global $wp_query;
$wp_query = new WP_Query($args);
echo '<div id="container">';
if (have_posts()) {
while (have_posts()) {
the_post();
$time = get_the_date('F j, Y');
$title_length = strlen(get_the_title());
$content = get_the_content();
$format_changed = "2015-11-23";
if (get_the_date('Y-m-d') > $format_changed) {
$snippet = substr($content, 0, strlen($content) - $title_length);
} else {
$snippet = substr($content, 0, strlen($content) - ($title_length + 4));
}
echo '<article class="post type-post status-publish format-standard entry brick masonry-brick teaser one-half">';
echo '<header class="entry-header"></header>';
echo '<div class="entry-content">';
echo '<h2 class="entry-title"> <a href="' . get_permalink() . '"> ' . get_the_title() . ' </a> </h2>';
// show the title
echo '<p class="entry-meta"><time class="entry-time" datetime="' . $time . '">' . $time . '</time>';
echo '<p>' . $snippet . '</p>';
// echo '<p> <a href="' . get_permalink() .'" class="more-link">Read more </a></p>';
echo '</div>';
echo '<footer class="entry-footer"></footer>';
echo '</article>';
}
echo '</div>';
do_action('genesis_after_endwhile');
}
wp_reset_query();
}
开发者ID:elliebartling,项目名称:skepticalblue,代码行数:41,代码来源:threesixty-template.php
示例20: wsm_child_has_ss_sidebar
/**
* Checks to see if simple sidebar exists
*
* @return string/boolean String of sidebar key OR false if none found
*/
function wsm_child_has_ss_sidebar($sidebar_key = '_ss_sidebar')
{
static $taxonomies = null;
if (is_singular() && ($sidebar_key = genesis_get_custom_field($sidebar_key))) {
return $sidebar_key;
}
if (is_category()) {
$term = get_term(get_query_var('cat'), 'category');
if (isset($term->meta[$sidebar_key])) {
return $term->meta[$sidebar_key];
}
}
if (is_tag()) {
$term = get_term(get_query_var('tag_id'), 'post_tag');
if (isset($term->meta[$sidebar_key])) {
return $term->meta[$sidebar_key];
}
}
if (is_tax()) {
if (function_exists('ss_do_sidebar')) {
if (null === $taxonomies) {
$taxonomies = ss_get_taxonomies();
}
foreach ($taxonomies as $tax) {
if ('post_tag' == $tax || 'category' == $tax) {
continue;
}
if (is_tax($tax)) {
$obj = get_queried_object();
$term = get_term($obj->term_id, $tax);
if (isset($term->meta[$sidebar_key])) {
return $term->meta[$sidebar_key];
}
break;
}
}
}
}
return false;
}
开发者ID:Bobcatou,项目名称:enhanceworldwide,代码行数:45,代码来源:sidebar.php
注:本文中的genesis_get_custom_field函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论