コード例 #1
0
ファイル: template-tags.php プロジェクト: juslee/e27
function usp_get_post_images($postId = false)
{
    global $usp_post_meta_Image;
    if (usp_is_public_submission($postId)) {
        if (false === $postId) {
            global $post;
            $postId = $post->ID;
        }
        return get_post_meta($postId, $usp_post_meta_Image);
    } else {
        return array();
    }
}
コード例 #2
0
function usp_display_featured_image()
{
    global $post, $usp_options;
    if (usp_is_public_submission($post->ID)) {
        if (!has_post_thumbnail() && $usp_options['usp_featured_images'] == 1) {
            $attachments = get_posts(array('post_type' => 'attachment', 'post_mime_type' => 'image', 'posts_per_page' => 0, 'post_parent' => $post->ID, 'order' => 'ASC'));
            if ($attachments) {
                foreach ($attachments as $attachment) {
                    set_post_thumbnail($post->ID, $attachment->ID);
                    break;
                }
            }
        }
    }
}
コード例 #3
0
function usp_meta_box_callback($post)
{
    global $usp_options;
    if (usp_is_public_submission()) {
        wp_nonce_field('usp_meta_box_nonce', 'usp_meta_box_nonce');
        $name = get_post_meta($post->ID, 'user_submit_name', true);
        $email = get_post_meta($post->ID, 'user_submit_email', true);
        $url = get_post_meta($post->ID, 'user_submit_url', true);
        $ip = get_post_meta($post->ID, 'user_submit_ip', true);
        if (!empty($name) || !empty($email) || !empty($url) || !empty($ip)) {
            echo '<ul style="margin-left:24px;list-style:square outside;">';
            if (!empty($name)) {
                echo '<li>' . __('Submitter Name: ', 'usp') . $name . '</li>';
            }
            if (!empty($email)) {
                echo '<li>' . __('Submitter Email: ', 'usp') . $email . '</li>';
            }
            if (!empty($url)) {
                echo '<li>' . __('Submitter URL: ', 'usp') . $url . '</li>';
            }
            if (!empty($ip) && !$usp_options['disable_ip_tracking']) {
                echo '<li>' . __('Submitter IP: ', 'usp') . $ip . '</li>';
            }
            echo '</ul>';
        }
    }
}
コード例 #4
0
ファイル: core-functions.php プロジェクト: vanlong200880/tmdt
function usp_auto_display_url($content)
{
    global $usp_options;
    $location = isset($usp_options['auto_display_url']) ? $usp_options['auto_display_url'] : '';
    $markup = isset($usp_options['auto_url_markup']) ? $usp_options['auto_url_markup'] : '';
    $url = apply_filters('usp_url_custom_field', get_post_meta(get_the_ID(), 'user_submit_url', true));
    if (!empty($url)) {
        $markup = preg_replace('/%%url%%/', $url, $markup);
        if (usp_is_public_submission()) {
            if ($location === 'before') {
                $content = $markup . $content;
            } elseif ($location === 'after') {
                $content = $content . $markup;
            }
        }
    }
    return $content;
}