本文整理汇总了PHP中genesis_get_custom_field函数的典型用法代码示例。如果您正苦于以下问题:PHP genesis_get_custom_field函数的具体用法?PHP genesis_get_custom_field怎么用?PHP genesis_get_custom_field使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了genesis_get_custom_field函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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');
}
}
示例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
}
示例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');
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}
示例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;
}
示例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
}
}
示例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;
}
}
示例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);
}
示例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
}
示例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();
}
}
示例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;
}