function pods_by_current_user_cpt($atts, $content = null)
{
    $current_user = wp_get_current_user();
    $user_id = $current_user->ID;
    $atts['where'] = 'post_author = ' . (int) $user_id;
    return pods_shortcode($atts, $content);
}
Beispiel #2
0
/**
 * Form Shortcode support for use anywhere that support WP Shortcodes
 *
 * @param array $tags An associative array of shortcode properties
 * @param string $content Not currently used
 *
 * @return string
 * @since 2.3
 */
function pods_shortcode_form($tags, $content = null)
{
    $tags['form'] = 1;
    return pods_shortcode($tags);
}
/**
 * processes template code within an each command from the base template
 *
 *
 * @param array attributes from template
 * @param string template to be processed
 *
 * @return null
 * @since 2.4
 */
function frontier_do_subtemplate($atts, $content)
{
    $out = null;
    $pod = pods($atts['pod'], $atts['id']);
    $params = array('name' => $atts['field']);
    $entries = $pod->field($atts['field']);
    if (!empty($pod->fields[$atts['field']]['table_info'])) {
        if (!empty($entries)) {
            foreach ($entries as $key => $entry) {
                $subpod = pods($pod->fields[$atts['field']]['pick_val']);
                $subatts = array('id' => $entry[$subpod->api->pod_data['field_id']], 'pod' => $pod->fields[$atts['field']]['pick_val']);
                $template = frontier_decode_template($content, array_merge($atts, $subatts));
                $template = str_replace('{_index}', $key, $template);
                $template = str_replace('{@' . $atts['field'] . '.', '{@', $template);
                $out .= pods_shortcode(array('name' => $pod->fields[$atts['field']]['pick_val'], 'slug' => $entry['ID'], 'index' => $key), $template);
            }
        }
    } else {
        if (!empty($entries)) {
            if ('file' == $pod->fields[$atts['field']]['type'] && 'attachment' == $pod->fields[$atts['field']]['options']['file_uploader'] && 'multi' == $pod->fields[$atts['field']]['options']['file_format_type']) {
                $template = frontier_decode_template($content, $atts);
                foreach ($entries as $key => $entry) {
                    $content = str_replace('{_index}', $key, $template);
                    $content = str_replace('{@_img', '{@image_attachment.' . $entry['ID'], $content);
                    $content = str_replace('{@_src', '{@image_attachment_url.' . $entry['ID'], $content);
                    $content = str_replace('{@' . $atts['field'] . '}', '{@image_attachment.' . $entry['ID'] . '}', $content);
                    $out .= pods_do_shortcode($pod->do_magic_tags($content), array('each', 'pod_sub_template', 'once', 'pod_once_template', 'before', 'pod_before_template', 'after', 'pod_after_template', 'if', 'pod_if_field'));
                }
            }
        }
    }
    return pods_do_shortcode($out, array('each', 'pod_sub_template', 'once', 'pod_once_template', 'before', 'pod_before_template', 'after', 'pod_after_template', 'if', 'pod_if_field'));
}
/**
 * processes template code within an each command from the base template
 *
 *
 * @param array attributes from template
 * @param string template to be processed
 *
 * @return null
 * @since 2.4
 */
function frontier_do_subtemplate($atts, $content)
{
    $out = null;
    $pod = pods($atts['pod'], $atts['id']);
    $params = array('name' => $atts['field']);
    $entries = $pod->field($atts['field']);
    if (!empty($entries)) {
        /**
         * Note on the change below for issue #3018:
         * ... || 'taxonomy' == $pod->fields[ $atts[ 'field' ] ][ 'type' ]
         *
         * calling field() above for a taxonomy object field will populate
         * $pod->fields[ $field_name ] for the object field's data, in this
         * case a taxonomy object field. Without calling
         * $pod->field( $field_name ), it would not normally be available in
         * the $pod->fields array and is something to not expect to be there in
         * 3.0 as this was unintentional.
         */
        if (!empty($pod->fields[$atts['field']]['table_info']) || 'taxonomy' == $pod->fields[$atts['field']]['type']) {
            foreach ($entries as $key => $entry) {
                $subpod = pods($pod->fields[$atts['field']]['pick_val']);
                $subatts = array('id' => $entry[$subpod->api->pod_data['field_id']], 'pod' => $pod->fields[$atts['field']]['pick_val']);
                $template = frontier_decode_template($content, array_merge($atts, $subatts));
                $template = str_replace('{_index}', $key, $template);
                $template = str_replace('{@' . $atts['field'] . '.', '{@', $template);
                // Kludge to work with taxonomies, pending a better solution: see issue #3018
                $target_id = null;
                if (isset($entry['ID'])) {
                    $target_id = $entry['ID'];
                } elseif (isset($entry['term_id'])) {
                    $target_id = $entry['term_id'];
                }
                $out .= pods_shortcode(array('name' => $pod->fields[$atts['field']]['pick_val'], 'slug' => $target_id, 'index' => $key), $template);
            }
        } elseif ('file' == $pod->fields[$atts['field']]['type'] && 'attachment' == $pod->fields[$atts['field']]['options']['file_uploader'] && 'multi' == $pod->fields[$atts['field']]['options']['file_format_type']) {
            $template = frontier_decode_template($content, $atts);
            foreach ($entries as $key => $entry) {
                $content = str_replace('{_index}', $key, $template);
                $content = str_replace('{@_img', '{@image_attachment.' . $entry['ID'], $content);
                $content = str_replace('{@_src', '{@image_attachment_url.' . $entry['ID'], $content);
                $content = str_replace('{@' . $atts['field'] . '}', '{@image_attachment.' . $entry['ID'] . '}', $content);
                $out .= pods_do_shortcode($pod->do_magic_tags($content), array('each', 'pod_sub_template', 'once', 'pod_once_template', 'before', 'pod_before_template', 'after', 'pod_after_template', 'if', 'pod_if_field'));
            }
        }
    }
    return pods_do_shortcode($out, array('each', 'pod_sub_template', 'once', 'pod_once_template', 'before', 'pod_before_template', 'after', 'pod_after_template', 'if', 'pod_if_field'));
}
 /**
  * Module Output
  */
 function _render($fields)
 {
     $args = array('name' => trim(pods_var_raw('pod_type', $fields['data'], '')), 'slug' => trim(pods_var_raw('slug', $fields['data'], '')), 'field' => trim(pods_var_raw('field', $fields['data'], '')));
     if (0 < strlen($args['name']) && 0 < strlen($args['slug']) && 0 < strlen($args['field'])) {
         echo pods_shortcode($args, isset($content) ? $content : null);
     }
 }
 /**
  * Module Output
  */
 function _render($fields)
 {
     $args = array('view' => trim(pods_var_raw('view', $fields['data'], '')), 'expires' => (int) trim(pods_var_raw('expires', $fields['data'], 60 * 5)), 'cache_mode' => trim(pods_var_raw('cache_mode', $fields['data'], 'transient', null, true)));
     if (0 < strlen($args['view']) && 'none' != $args['cache_mode']) {
         echo pods_shortcode($args);
     }
 }
Beispiel #7
0
<?php

echo $before_widget;
if (!empty($title)) {
    echo $before_title . $title . $after_title;
}
echo pods_shortcode($args, isset($content) ? $content : null);
echo $after_widget;
 /**
  * Module Output
  */
 function _render($fields)
 {
     $args = array('name' => trim(pods_var_raw('pod_type', $fields['data'], '')), 'slug' => trim(pods_var_raw('slug', $fields['data'], '')), 'fields' => trim(pods_var_raw('fields', $fields['data'], '')), 'label' => trim(pods_var_raw('label', $fields['data'], __('Submit', 'pods'), null, true)), 'thank_you' => trim(pods_var_raw('thank_you', $fields['data'], '')), 'form' => 1);
     if (0 < strlen($args['name'])) {
         echo pods_shortcode($args, isset($content) ? $content : null);
     }
 }
 /**
  * Module Output
  */
 function _render($fields)
 {
     $args = array('name' => trim(pods_var_raw('pod_type', $fields['data'], '')), 'template' => trim(pods_var_raw('template', $fields['data'], '')), 'limit' => (int) pods_var_raw('limit', $fields['data'], 15, null, true), 'orderby' => trim(pods_var_raw('orderby', $fields['data'], '')), 'where' => trim(pods_var_raw('where', $fields['data'], '')), 'expires' => (int) trim(pods_var_raw('expires', $fields['data'], 60 * 5)), 'cache_mode' => trim(pods_var_raw('cache_mode', $fields['data'], 'transient', null, true)));
     $content = trim(pods_var_raw('template_custom', $fields['data'], ''));
     if (0 < strlen($args['name']) && (0 < strlen($args['template']) || 0 < strlen($content))) {
         echo pods_shortcode($args, isset($content) ? $content : null);
     }
 }