本文整理汇总了PHP中beans_get函数的典型用法代码示例。如果您正苦于以下问题:PHP beans_get函数的具体用法?PHP beans_get怎么用?PHP beans_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了beans_get函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: beans_field_radio
/**
* Echo radio field type.
*
* @since 1.0.0
*
* @param array $field {
* For best practices, pass the array of data obtained using {@see beans_get_fields()}.
*
* @type mixed $value The field value.
* @type string $name The field name value.
* @type array $attributes An array of attributes to add to the field. The array key defines the
* attribute name and the array value defines the attribute value. Default array.
* @type mixed $default The default value. Default false.
* @type array $options An array used to populate the radio options. The array key defines radio
* value and the array value defines the radio label or image path.
* }
*/
function beans_field_radio($field)
{
if (empty($field['options'])) {
return;
}
$field['default'] = isset($checkbox['default']) ? $checkbox['default'] : key($field['options']);
echo '<fieldset>';
$i = 0;
foreach ($field['options'] as $id => $radio) {
$checked = $id == $field['value'] ? ' checked="checked"' : null;
$extensions = array('jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico');
$has_image = in_array(beans_get('extension', pathinfo($radio)), $extensions) ? 'bs-has-image' : false;
echo '<label class="' . $has_image . '">';
if ($has_image) {
echo '<img src="' . $radio . '" />';
}
echo '<input type="radio" name="' . $field['name'] . '" value="' . $id . '" ' . $checked . ' ' . beans_sanatize_attributes($field['attributes']) . '/>';
if (!$has_image) {
echo $radio;
}
echo '</label>';
$i++;
}
echo '</fieldset>';
}
开发者ID:KevinFairbanks,项目名称:Beans,代码行数:42,代码来源:radio.php
示例2: beans_get_term_meta
/**
* Get the current term meta value.
*
* @since 1.0.0
*
* @param string $field_id The term meta id searched.
* @param mixed $default The default value to return if the term meta value doesn't exist.
* @param int $term_id Overwrite the current term id.
*
* @return mixed Save data if the term meta value exists, otherwise set the default value.
*/
function beans_get_term_meta($field_id, $default = false, $term_id = false)
{
if (!$term_id) {
$term_id = ($_term_id = beans_get('term_id', get_queried_object())) ? $_term_id : beans_get('tag_ID');
}
return get_option("beans_term_{$term_id}_{$field_id}", $default);
}
开发者ID:ThemeButler,项目名称:Beans,代码行数:18,代码来源:functions.php
示例3: page
/**
* Page content.
*/
public function page($page)
{
global $wp_meta_boxes;
if (!($boxes = beans_get($page, $wp_meta_boxes))) {
return;
}
// Only add column class if there is more than 1 metaboxes.
$column_class = beans_get('column', $boxes, array()) ? ' column' : false;
// Set page data which will be used by the postbox.
echo '<form action="" method="post" class="bs-options" data-page="' . beans_get('page') . '">';
wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
echo '<input type="hidden" name="beans_options_nonce" value="' . esc_attr(wp_create_nonce('beans_options_nonce')) . '" />';
echo '<div class="metabox-holder' . $column_class . '">';
do_meta_boxes($page, 'normal', null);
if ($column_class) {
do_meta_boxes($page, 'column', null);
}
echo '</div>';
echo '<p class="bs-options-form-actions">
<input type="submit" name="beans_save_options" value="Save" class="button-primary">
<input type="submit" name="beans_reset_options" value="Reset" class="button-secondary">
</p>';
echo '</form>';
}
开发者ID:KevinFairbanks,项目名称:Beans,代码行数:28,代码来源:class.php
示例4: beans_updater
/**
* Retrieve product data from Beans REST API.
*
* Data are cached in a 24 hours transients and will be returned if found to avoid long loading time.
*
* @ignore
*/
function beans_updater($value)
{
$data = get_site_transient('beans_updater');
$theme = wp_get_theme('tm-beans');
if (!$theme->exists()) {
return $value;
}
$current_version = $theme->get('Version');
// Query Beans REST API if the transient is expired.
if (empty($data)) {
$args = array('timeout' => 15, 'sslverify' => false);
$response = wp_remote_get('http://www.getbeans.io/rest-api/', $args);
if (is_wp_error($response)) {
return $value;
}
// Retrieve data from the body and decode json format.
$data = json_decode(wp_remote_retrieve_body($response), true);
// Stop here if the is an error.
if (isset($data['error'])) {
// Set temporary transient.
set_site_transient('beans_updater', array('version' => $current_version), 30 * MINUTE_IN_SECONDS);
return $value;
}
set_site_transient('beans_updater', $data, 24 * HOUR_IN_SECONDS);
}
// Return data if Beans is not up to date.
if (version_compare($current_version, beans_get('version', $data), '<')) {
$value->response[$data['path']] = array('slug' => $data['slug'], 'name' => $data['name'], 'url' => $data['changelog_url'], 'package' => $data['download_url'], 'new_version' => $data['version'], 'tested' => $data['tested'], 'requires' => $data['requires']);
return $value;
}
return $value;
}
开发者ID:JoomPassion,项目名称:Beans,代码行数:39,代码来源:updater.php
示例5: _beans_is_admin_post_type
/**
* Check if the current screen is a given post type.
*
* @ignore
*/
function _beans_is_admin_post_type($post_types)
{
// Check if it is a new post and treat it as such.
if (stripos($_SERVER['REQUEST_URI'], 'post-new.php') !== false) {
if (!($current_post_type = beans_get('post_type'))) {
return false;
}
} else {
// Try to get id from $_GET.
if ($id = beans_get('post')) {
$post_id = $id;
} elseif ($id = beans_post('post_ID')) {
$post_id = $id;
}
if (!isset($post_id)) {
return false;
}
$current_post_type = get_post_type($post_id);
}
if ($post_types === true) {
return true;
}
if (in_array($current_post_type, (array) $post_types)) {
return true;
}
// Support post ids.
if (isset($post_id) && in_array($post_id, (array) $post_types)) {
return true;
}
return false;
}
开发者ID:ThemeButler,项目名称:tm-demo,代码行数:36,代码来源:functions-admin.php
示例6: beans_field_checkbox
/**
* Echo checkbox field type.
*
* @since 1.0.0
*
* @param array $field {
* For best practices, pass the array of data obtained using {@see beans_get_fields()}.
*
* @type mixed $value The field value.
* @type string $name The field name value.
* @type array $attributes An array of attributes to add to the field. The array key defines the
* attribute name and the array value defines the attribute value. Default array.
* @type mixed $default The default value. Default false.
* @type string $checkbox_label The field checkbox label. Default 'Enable'.
* }
*/
function beans_field_checkbox($field)
{
?>
<input type="hidden" value="0" name="<?php
echo esc_attr($field['name']);
?>
" />
<input type="checkbox" name="<?php
echo esc_attr($field['name']);
?>
" value="1" <?php
checked($field['value'], 1);
?>
<?php
echo beans_esc_attributes($field['attributes']);
?>
/>
<?php
if ($checkbox_label = beans_get('checkbox_label', $field, __('Enable', 'tm-beans'))) {
?>
<span class="bs-checkbox-label"><?php
echo $checkbox_label;
?>
</span>
<?php
}
}
开发者ID:Getbeans,项目名称:Beans,代码行数:43,代码来源:checkbox.php
示例7: beans_field_radio
/**
* Echo radio field type.
*
* @since 1.0.0
*
* @param array $field {
* For best practices, pass the array of data obtained using {@see beans_get_fields()}.
*
* @type mixed $value The field value.
* @type string $name The field name value.
* @type array $attributes An array of attributes to add to the field. The array key defines the
* attribute name and the array value defines the attribute value. Default array.
* @type mixed $default The default value. Default false.
* @type array $options An array used to populate the radio options. The array key defines radio
* value and the array value defines the radio label or image path.
* }
*/
function beans_field_radio($field)
{
if (empty($field['options'])) {
return;
}
$field['default'] = isset($checkbox['default']) ? $checkbox['default'] : key($field['options']);
?>
<fieldset>
<?php
$i = 0;
foreach ($field['options'] as $id => $radio) {
$extensions = array('jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico');
$has_image = in_array(beans_get('extension', pathinfo($radio)), $extensions) ? 'bs-has-image' : false;
?>
<label class="<?php
echo esc_attr($has_image);
?>
">
<?php
if ($has_image) {
?>
<img src="<?php
echo esc_url($radio);
?>
"/>
<?php
}
?>
<input type="radio" name="<?php
echo esc_attr($field['name']);
?>
" value="<?php
echo esc_attr($id);
?>
" <?php
checked($id, $field['value'], 1);
?>
<?php
echo beans_esc_attributes($field['attributes']);
?>
/>
<?php
if (!$has_image) {
?>
<?php
echo $radio;
?>
<?php
}
?>
</label>
<?php
$i++;
}
?>
</fieldset>
<?php
}
开发者ID:Getbeans,项目名称:Beans,代码行数:76,代码来源:radio.php
示例8: beans_comments_template
/**
* Echo comments template part.
*
* The comments template part only loads if comments are active to prevent unnecessary memory usage.
*
* @since 1.0.0
*/
function beans_comments_template()
{
global $post;
if (!post_type_supports(beans_get('post_type', $post), 'comments')) {
return;
}
comments_template();
}
开发者ID:KevinFairbanks,项目名称:Beans,代码行数:15,代码来源:template-parts.php
示例9: beans_field_checkbox
/**
* Echo checkbox field type.
*
* @since 1.0.0
*
* @param array $field {
* For best practices, pass the array of data obtained using {@see beans_get_fields()}.
*
* @type mixed $value The field value.
* @type string $name The field name value.
* @type array $attributes An array of attributes to add to the field. The array key defines the
* attribute name and the array value defines the attribute value. Default array.
* @type mixed $default The default value. Default false.
* @type string $checkbox_label The field checkbox label. Default 'Enable'.
* }
*/
function beans_field_checkbox($field)
{
$checked = $field['value'] ? ' checked="checked"' : null;
echo '<input type="hidden" value="0" name="' . $field['name'] . '" />';
echo '<input type="checkbox" name="' . $field['name'] . '" value="1" ' . $checked . ' ' . beans_sanatize_attributes($field['attributes']) . ' />';
if ($checkbox_label = beans_get('checkbox_label', $field, 'Enable')) {
echo '<span class="bs-checkbox-label">' . $checkbox_label . '</span>';
}
}
开发者ID:ThemeButler,项目名称:tm-demo,代码行数:25,代码来源:checkbox.php
示例10: do_once
/**
* Trigger actions only once.
*/
private function do_once()
{
static $once = false;
if (!$once) {
add_action(beans_get('taxonomy') . '_edit_form', array($this, 'nonce'));
add_action('edit_term', array($this, 'save'));
add_action('delete_term', array($this, 'delete'), 10, 3);
$once = true;
}
}
开发者ID:KevinFairbanks,项目名称:Beans,代码行数:13,代码来源:class.php
示例11: beans_get_post_meta
/**
* Get the current post meta value.
*
* This function is a shortcut of {@link http://codex.wordpress.org/Function_Reference/get_post_meta get_post_meta()}.
*
* @since 1.0.0
*
* @param string $field_id The post meta id searched.
* @param mixed $default The default value to return of the post meta value doesn't exist.
* @param int $term_id Overwrite the current post id.
*
* @return mixed Saved data if exist, otherwise default value set.
*/
function beans_get_post_meta($field_id, $default = false, $post_id = false)
{
if (!$post_id) {
$post_id = !($id = get_the_id()) ? beans_get('post') : $id;
}
$post_meta = get_post_meta($post_id);
if (isset($post_meta[$field_id])) {
return get_post_meta($post_id, $field_id, true);
}
return $default;
}
开发者ID:ThemeButler,项目名称:Beans,代码行数:24,代码来源:functions.php
示例12: beans_field_description
/**
* Echo field description.
*
* @since 1.0.0
*
* @param array $field {
* Array of data.
*
* @type string $description The field description. The description can be truncated using <!--more-->
* as a delimiter. Default false.
* }
*/
function beans_field_description($field)
{
if (!($description = beans_get('description', $field))) {
return;
}
echo beans_open_markup('beans_field_description', 'div', array('class' => 'bs-field-description'));
if (preg_match('#<!--more-->#', $description, $matches)) {
list($description, $extended) = explode($matches[0], $description, 2);
}
echo $description;
if (isset($extended)) {
echo ' <a class="bs-read-more" href="#">' . __('More...', 'beans') . '</a>';
echo '<div class="bs-extended-content">' . $extended . '</div>';
}
echo beans_close_markup('beans_field_description', 'div');
}
开发者ID:ThemeButler,项目名称:tm-demo,代码行数:28,代码来源:field.php
示例13: beans_register_options
/**
* Register options.
*
* This function should only be invoked through the 'admin_init' action.
*
* @since 1.0.0
*
* @param array $fields {
* Array of fields to register.
*
* @type string $id A unique id used for the field. This id will also be used to save the value in
* the database.
* @type string $type The type of field to use. Please refer to the Beans core field types for more
* information. Custom field types are accepted here.
* @type string $label The field label. Default false.
* @type string $description The field description. The description can be truncated using <!--more-->
* as a delimiter. Default false.
* @type array $attributes An array of attributes to add to the field. The array key defines the
* attribute name and the array value defines the attribute value. Default array.
* @type mixed $default The default field value. Default false.
* @type array $fields Must only be used for 'group' field type. The array arguments are similar to the
* {@see beans_register_fields()} $fields arguments.
* @type bool $db_group Must only be used for 'group' field types. Defines whether the group of fields
* registered should be saved as a group in the database or as individual
* entries. Default false.
* }
* @param string $menu_slug The menu slug used by fields.
* @param string $section A section id to define the group of fields.
* @param array $args {
* Optional. Array of arguments used to register the fields.
*
* @type string $title The metabox Title. Default 'Undefined'.
* @type string $context Where on the page where the metabox should be shown
* ('normal', 'column'). Default 'normal'.
* }
*
* @return bool True on success, false on failure.
*/
function beans_register_options(array $fields, $menu_slug, $section, $args = array())
{
$fields = apply_filters("beans_options_fields_{$section}", _beans_pre_standardize_fields($fields));
$menu_slug = apply_filters("beans_options_menu_slug_{$section}", $menu_slug);
// Stop here if the page isn't concerned.
if (beans_get('page') !== $menu_slug || !is_admin()) {
return;
}
// Stop here if the field can't be registered.
if (!beans_register_fields($fields, 'option', $section)) {
return false;
}
// Load the class only if this function is called to prevent unnecessary memory usage.
require_once BEANS_API_COMPONENTS_PATH . 'options/class.php';
$class = new _Beans_Options();
$class->register($section, $args);
return true;
}
开发者ID:ThemeButler,项目名称:tm-demo,代码行数:56,代码来源:functions.php
示例14: beans_field_image
/**
* Echo image field type.
*
* @since 1.0.0
*
* @param array $field {
* For best practices, pass the array of data obtained using {@see beans_get_fields()}.
*
* @type mixed $value The field value.
* @type string $name The field name value.
* @type array $attributes An array of attributes to add to the field. The array key defines the
* attribute name and the array value defines the attribute value. Default array.
* @type mixed $default The default value. Default false.
* @type string $multiple Set to true to enable mutliple images (gallery). Default false.
* }
*/
function beans_field_image($field)
{
// Set the images variable and add placeholder to the array.
$images = array_merge((array) $field['value'], array('placeholder'));
// Is multiple set.
$multiple = beans_get('multiple', $field);
// Hide beans if it is a single image and an image already exists
$hide = !$multiple && is_numeric($field['value']) ? 'style="display: none"' : '';
echo '<a href="#" class="bs-add-image button button-small" ' . $hide . '>';
echo _n('Add Image', 'Add Images', $multiple ? 2 : 1, 'beans');
echo '</a>';
echo '<input type="hidden" name="' . $field['name'] . '" value="">';
echo '<div class="bs-images-wrap" data-multiple="' . $multiple . '">';
foreach ($images as $id) {
// Stop here if the id is false.
if (!$id) {
continue;
}
$class = '';
$img = wp_get_attachment_image_src($id, 'thumbnail');
$attributes = array_merge(array('class' => 'image-id', 'type' => 'hidden', 'name' => $multiple ? $field['name'] . '[]' : $field['name'], 'value' => $id), $field['attributes']);
// Set placeholder.
if ($id == 'placeholder') {
$class = 'bs-image-template';
$attributes = array_merge($attributes, array('disabled' => 'disabled', 'value' => false));
}
echo '<div class="bs-image-wrap ' . $class . '">';
echo '<input ' . beans_sanatize_attributes($attributes) . ' />';
echo '<img src="' . beans_get(0, $img) . '">';
echo '<div class="bs-toolbar">';
if ($multiple) {
echo '<a href="#" class="dashicons dashicons-menu"></a>';
}
echo '<a href="#" class="dashicons dashicons-edit"></a>';
echo '<a href="#" class="dashicons dashicons-post-trash"></a>';
echo '</div>';
echo '</div>';
}
echo '</div>';
}
开发者ID:ThemeButler,项目名称:tm-demo,代码行数:56,代码来源:image.php
示例15: tbr_blog_top
function tbr_blog_top()
{
?>
<div class="uk-clearfix">
<div id="js-blog-filters" class="filters uk-float-left">
<nav class="uk-clearfix">
<a href="#offcanvas_filters" class="uk-hidden-large uk-float-left tm-filters uk-button uk-button-small" data-uk-offcanvas><i class="uk-icon-filter"></i> Show Filters</a>
<ul id="filters" class="uk-subnav uk-subnav-line uk-margin-large-bottom uk-visible-large">
<li<?php
echo !beans_get('filter_term_id') ? ' class="uk-active"' : '';
?>
data-uk-filter=""><a href="/blog/">All</a></li>
<?php
foreach (get_terms('category', array('orderby' => 'id', 'hide_empty' => true)) as $term) {
?>
<li<?php
echo beans_get('filter_term_id') == $term->term_id ? ' class="uk-active"' : '';
?>
data-uk-filter="<?php
echo $term->name;
?>
"><a href="<?php
echo add_query_arg('filter_term_id', $term->term_id);
?>
"><?php
echo $term->name;
?>
</a></li>
<?php
}
?>
</ul>
</nav>
</div>
</div>
<?php
}
开发者ID:ThemeButler,项目名称:tm-site,代码行数:37,代码来源:index.php
示例16: beans_field_description
/**
* Echo field description.
*
* @since 1.0.0
*
* @param array $field {
* Array of data.
*
* @type string $description The field description. The description can be truncated using <!--more-->
* as a delimiter. Default false.
* }
*/
function beans_field_description($field)
{
if (!($description = beans_get('description', $field))) {
return;
}
beans_open_markup_e('beans_field_description[_' . $field['id'] . ']', 'div', array('class' => 'bs-field-description'));
if (preg_match('#<!--more-->#', $description, $matches)) {
list($description, $extended) = explode($matches[0], $description, 2);
}
echo $description;
if (isset($extended)) {
?>
<br /><a class="bs-read-more" href="#"><?php
_e('More...', 'tm-beans');
?>
</a>
<div class="bs-extended-content"><?php
echo $extended;
?>
</div>
<?php
}
beans_close_markup_e('beans_field_description[_' . $field['id'] . ']', 'div');
}
开发者ID:Getbeans,项目名称:Beans,代码行数:36,代码来源:field.php
示例17: beans_register_options
/**
* Register options.
*
* This function should only be invoked through the 'admin_init' action.
*
* @since 1.0.0
*
* @param array $fields {
* Array of fields to register.
*
* @type string $id A unique id used for the field. This id will also be used to save the value in
* the database.
* @type string $type The type of field to use. Please refer to the Beans core field types for more
* information. Custom field types are accepted here.
* @type string $label The field label. Default false.
* @type string $description The field description. The description can be truncated using <!--more-->
* as a delimiter. Default false.
* @type array $attributes An array of attributes to add to the field. The array key defines the
* attribute name and the array value defines the attribute value. Default array.
* @type mixed $default The default field value. Default false.
* @type array $fields Must only be used for 'group' field type. The array arguments are similar to the
* {@see beans_register_fields()} $fields arguments.
* @type bool $db_group Must only be used for 'group' field types. Defines whether the group of fields
* registered should be saved as a group in the database or as individual
* entries. Default false.
* }
* @param string $menu_slug The menu slug used by fields.
* @param string $section A section id to define the group of fields.
* @param array $args {
* Optional. Array of arguments used to register the fields.
*
* @type string $title The metabox Title. Default 'Undefined'.
* @type string $context Where on the page where the metabox should be shown
* ('normal', 'column'). Default 'normal'.
* }
*
* @return bool True on success, false on failure.
*/
function beans_register_options(array $fields, $menu_slug, $section, $args = array())
{
/**
* Filter the options fields.
*
* The dynamic portion of the hook name, $section, refers to the section id which defines the group of fields.
*
* @since 1.0.0
*
* @param array $fields An array of options fields.
*/
$fields = apply_filters("beans_options_fields_{$section}", _beans_pre_standardize_fields($fields));
/**
* Filter the options fields menu slug.
*
* The dynamic portion of the hook name, $section, refers to the section id which defines the group of fields.
*
* @since 1.0.0
*
* @param array $menu_slug The menu slug.
*/
$menu_slug = apply_filters("beans_options_menu_slug_{$section}", $menu_slug);
// Stop here if the page isn't concerned.
if (beans_get('page') !== $menu_slug || !is_admin()) {
return;
}
// Stop here if the field can't be registered.
if (!beans_register_fields($fields, 'option', $section)) {
return false;
}
// Load the class only if this function is called to prevent unnecessary memory usage.
require_once BEANS_API_PATH . 'options/class.php';
$class = new _Beans_Options();
$class->register($section, $args);
return true;
}
开发者ID:Getbeans,项目名称:Beans,代码行数:74,代码来源:functions.php
示例18: register
/**
* Register options.
*/
public function register()
{
global $wp_meta_boxes;
$fields = array(array('id' => 'beans_dev_mode', 'checkbox_label' => __('Enable development mode', 'beans'), 'type' => 'checkbox', 'description' => 'This option should be enabled while your website is in development.'));
beans_register_options($fields, 'beans_settings', 'mode_options', array('title' => __('Mode options', 'beans'), 'context' => beans_get('beans_settings', $wp_meta_boxes) ? 'column' : 'normal'));
}
开发者ID:JoomPassion,项目名称:Beans,代码行数:9,代码来源:admin-menu.php
示例19: start_el
/**
* Extend WordPress start menu elements.
*
* @ignore
*/
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
{
// Stop here if the depth is smaller than starting depth.
if ($depth < $args->beans_start_level) {
return;
}
$item_id = $item->ID;
// Wp item attributes.
$id = apply_filters('nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args);
$classes = empty($item->classes) ? array() : (array) $item->classes;
$classes[] = 'menu-item-' . $item->ID;
$_classes = join(' ', (array) apply_filters('nav_menu_css_class', array_filter($classes), $item, $args));
// WP link attributes.
$_link_attr = array('title' => $item->attr_title, 'target' => $item->target, 'rel' => $item->xfn, 'href' => $item->url);
// Prevent empty WP link attributes.
foreach ($_link_attr as $attr => $value) {
if (!empty($value)) {
$link_attr[$attr] = $value;
}
}
$link_attr = apply_filters('nav_menu_link_attributes', $link_attr, $item, $args);
// Set wp item attributes as defaults.
$item_attr = array('class' => array($_classes));
// Add UIKit active class.
if (in_array('current-menu-item', $classes)) {
$item_attr['class'][] = 'uk-active';
}
// Add UIKit parent attributes.
if ($depth == $args->beans_start_level && in_array('menu-item-has-children', $classes)) {
$item_attr['class'][] = 'uk-parent';
if (beans_get('beans_type', $args) == 'navbar') {
$item_attr['data-uk-dropdown'] = '';
$child_indicator = true;
}
}
// Implode to avoid empty spaces.
$item_attr['class'] = implode(' ', array_filter($item_attr['class']));
// Set to null if empty to avoid outputing empty class html attribute.
if (!$item_attr['class']) {
$item_attr['class'] = null;
}
$output .= beans_open_markup("beans_menu_item[_{$item_id}]", 'li', $item_attr, $item, $depth, $args);
$item_output = $args->before;
$item_output .= beans_open_markup("beans_menu_item_link[_{$item_id}]", 'a', $link_attr, $item, $depth, $args);
$item_output .= beans_output("beans_menu_item_text[_{$item_id}]", $args->link_before . apply_filters('the_title', $item->title, $item->ID) . $args->link_after);
if (isset($child_indicator)) {
$item_output .= beans_open_markup("beans_menu_item_child_indicator[_{$item_id}]", 'i', array('class' => 'uk-icon-caret-down uk-margin-small-left'), $item, $depth, $args);
$item_output .= beans_close_markup("beans_menu_item_child_indicator[_{$item_id}]", 'i', $item, $depth, $args);
}
$item_output .= beans_close_markup("beans_menu_item_link[_{$item_id}]", 'a', $link_attr, $item, $depth, $args);
$item_output .= $args->after;
$output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args);
}
开发者ID:ThemeButler,项目名称:tm-demo,代码行数:58,代码来源:walker.php
示例20: tbr_resources_loop
function tbr_resources_loop($query)
{
$query_args = array('post_type' => 'resources');
if ($term_id = beans_get('filter_term_id')) {
$query_args = array_merge($query_args, array('tax_query' => array(array('taxonomy' => 'resource_type', 'field' => 'term_id', 'terms' => beans_get('filter_term_id')))));
}
$the_query = new WP_Query($query_args);
if (wp_is_mobile()) {
$filter_id = 'mobile-filters';
} else {
$filter_id = 'filters';
}
?>
<div class="tm-index-wrap tm-portfolio tm-lazy uk-grid-width-1-1 uk-grid-width-small-1-2 uk-grid-width-medium-1-3" data-uk-grid="{gutter: 30, controls: '#<?php
echo $filter_id;
?>
'}">
<?php
if ($the_query->have_posts()) {
while ($the_query->have_posts()) {
$the_query->the_post();
global $post;
$thumb_id = get_post_thumbnail_id();
$thumb_url_array = wp_get_attachment_image_src($thumb_id, 'full-size', true);
$resized_src = beans_edit_image($thumb_url_array[0], array('resize' => array(407, 379, array('center', 'top'))));
$resource_cats = get_the_terms($post->ID, 'resource_type');
$resource_cats = array_values($resource_cats);
for ($cat_count = 0; $cat_count < count($resource_cats); $cat_count++) {
$resource_type = $resource_cats[$cat_count]->name;
$lowercase_resource_type = strtolower($resource_type);
if ($cat_count < count($resource_cats) - 1) {
echo ', ';
}
}
?>
<div class="tm-item" data-uk-filter="<?php
echo $lowercase_resource_type;
?>
">
<div class="uk-article">
<a rel="bookmark" href="<?php
echo get_permalink();
?>
" title="<?php
the_title();
?>
">
<img src="<?php
echo $resized_src;
?>
" width="407" height="378" alt="<?php
the_title();
?>
" />
</a>
<div class="uk-panel uk-panel-box">
<h3 class="uk-margin-top-remove"><a rel="bookmark" href="<?php
echo get_permalink();
?>
" title="<?php
the_title();
?>
"><?php
the_title();
?>
</a></h3>
<div class="tm-meta"><?php
echo get_the_term_list($post->ID, 'resource_type', '', '');
echo get_the_term_list($post->ID, 'resource_tags', '', '');
?>
</div>
<p><?php
the_excerpt();
?>
</p>
<p class="uk-margin-remove"><a rel="bookmark" class="uk-button uk-button-small uk-button-secondary" href="<?php
echo get_permalink();
?>
" title="Learn more">Learn more</a></p>
</div>
</div>
</div>
<?php
}
} else {
?>
<p>Sorry, there are no posts to display</p>
<?php
}
?>
</div>
<?php
wp_reset_query();
}
开发者ID:ThemeButler,项目名称:tm-site,代码行数:96,代码来源:archive-resources.php
注:本文中的beans_get函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论