コード例 #1
2
 public function display_media($location, $fallback = true, $fallbackhome = false)
 {
     global $post;
     ob_start();
     $media = $this->query_attachments($post->ID, $location);
     if (!$media->have_posts() && $fallback == true) {
         $media = $this->query_attachments($post->post_parent, $location);
     }
     if (!$media->have_posts() && $fallbackhome == true) {
         $frontpage_id = get_option('page_on_front');
         $media = $this->query_attachments($frontpage_id, $location);
     }
     if ($media->have_posts()) {
         while ($media->have_posts()) {
             $media->the_post();
             $media_info = get_post_custom(get_the_ID());
             if (isset($media_info['image_link']) && $media_info['image_link'][0]) {
                 echo '<a href="' . $media_info['image_link'][0] . '">';
             }
             echo wp_get_attachment_image(get_the_ID(), 'full');
             if (isset($media_info['image_link']) && $media_info['image_link'][0]) {
                 echo '</a>';
             }
         }
         wp_reset_postdata();
     } else {
         return false;
     }
     return ob_get_clean();
 }
コード例 #2
0
function custom_sidebar_callback($post)
{
    global $wp_registered_sidebars;
    $template_name = get_post_meta($post->ID, '_wp_page_template', true);
    $custom = get_post_custom($post->ID);
    if (isset($custom['custom_sidebar'])) {
        $val = $custom['custom_sidebar'][0];
    } elseif ($template_name == "template-contact.php") {
        $val = "Contact Page Sidebar";
    } else {
        $val = "0";
    }
    // Use nonce for verification
    wp_nonce_field(plugin_basename(__FILE__), 'custom_sidebar_nonce');
    // The actual fields for data entry
    $output = '<p><label for="myplugin_new_field">' . __("Choose a sidebar to display", 'kingsize') . '</label></p>';
    $output .= "<select name='custom_sidebar'>";
    // Add a default option
    $output .= "<option";
    if ($val == "0") {
        $output .= " selected='selected'";
    }
    $output .= " value='0'>" . __('Default', $themename) . "</option>";
    // Fill the select element with all registered sidebars
    foreach ($wp_registered_sidebars as $sidebar_id => $sidebar) {
        //
        $output .= "<option";
        if ($sidebar['name'] == $val) {
            $output .= " selected='selected'";
        }
        $output .= " value='" . $sidebar['name'] . "'>" . $sidebar['name'] . "</option>";
    }
    $output .= "</select>";
    echo $output;
}
 public function do_shortcode($args)
 {
     $content_type = get_post_type();
     $ct_settings = get_option(RAPHAEL_SETTINGS . '_' . $content_type);
     $settings = get_option(RAPHAEL_SETTINGS);
     $custom = get_post_custom();
     //dpr(get_defined_vars());
     $values = $colors = $labels = array();
     foreach ($ct_settings['active_custom_fields'] as $field) {
         $values[] = $custom[$field][0];
         $colors[] = $ct_settings['custom_field_colors'][$field];
         if ($ct_settings[$content_type . '_showlabels']) {
             $labels[] = str_replace("%v%", $custom[$field][0], $ct_settings['custom_field_label'][$field]);
         }
     }
     //dpr(get_defined_vars());dpr($ct_settings[$content_type.'_dohover']);
     $js = self::script_bar_chart($values, $colors, $labels, $ct_settings[$content_type . '_barendtype'], 'chart-wrapper', $ct_settings[$content_type . '_dohover']);
     //$func = function() use ($js) { print $js; };
     //$code = "print '$js';";
     //$func = create_function('', $code);
     //dpr(get_defined_vars());
     //add_action('wp_footer', $func );
     self::$footer_js .= $js;
     return '<div id="chart-wrapper" style="width:' . $ct_settings[$content_type . '_chartwidth'] . 'px; height:' . $ct_settings[$content_type . '_chartheight'] . 'px;"></div>';
 }
コード例 #4
0
 public static function credits_meta()
 {
     global $post;
     $data = array();
     $custom = get_post_custom($post->ID);
     $data['portfolio_date'] = @$custom["portfolio_date"][0];
     $data['portfolio_clients'] = @$custom["portfolio_clients"][0];
     $data['portfolio_tools'] = @$custom["portfolio_tools"][0];
     $data['tmm_portfolio'] = unserialize(@$custom["tmm_portfolio"][0]);
     //***
     $data['portfolio_camera'] = @$custom["portfolio_camera"][0];
     $data['portfolio_camera_label'] = @$custom["portfolio_camera_label"][0];
     $data['portfolio_lens'] = @$custom["portfolio_lens"][0];
     $data['portfolio_lens'] = @$custom["portfolio_lens_label"][0];
     $data['portfolio_tripod_or_handheld'] = @$custom["portfolio_tripod_or_handheld"][0];
     $data['portfolio_tripod_or_handheld_label'] = @$custom["portfolio_tripod_or_handheld_label"][0];
     $data['portfolio_fl'] = @$custom["portfolio_fl"][0];
     $data['portfolio_fl_label'] = @$custom["portfolio_fl_label"][0];
     $data['portfolio_exposure'] = @$custom["portfolio_exposure"][0];
     $data['portfolio_exposure_label'] = @$custom["portfolio_exposure_label"][0];
     $data['portfolio_brackets'] = @$custom["portfolio_brackets"][0];
     $data['portfolio_brackets_label'] = @$custom["portfolio_brackets_label"][0];
     $data['portfolio_processed'] = @$custom["portfolio_processed"][0];
     $data['portfolio_processed_label'] = @$custom["portfolio_processed_label"][0];
     $data['portfolio_etc'] = @$custom["portfolio_etc"][0];
     $data['portfolio_etc_label'] = @$custom["portfolio_etc_label"][0];
     //***
     echo TMM::draw_html('portfolio/credits_meta', $data);
 }
コード例 #5
0
ファイル: team-meta.php プロジェクト: panopticist/oats
function job_title($post)
{
    $values = get_post_custom($post->ID);
    $job_title = isset($values['job_title']) ? esc_attr($values['job_title'][0]) : '';
    wp_nonce_field('my_meta_box_nonce', 'meta_box_nonce');
    ?>
	<style type="text/css" media="screen">
	  #job_title_box{}
	  #job_title_box label,
	  #job_title_box input,
	  #job_title_box small{}
	  #job_title_box label{
	    padding:0 2px;
	  }
    #job_title{
      width:100%;
    }
    #job_title_box small{
      padding:0 3px;
      color:#999;
    }
	</style>
	<div id="job_title_box">
  	<p>
  		<label for="job_title">Job title</label><br />
  		<input type="text" name="job_title" id="job_title" value="<?php 
    echo $job_title;
    ?>
" /><br />
  		<small>e.g. Director of Operations</small>
  	</p>

	</div><!-- #job_title_box -->
	<?php 
}
コード例 #6
0
 /**
  * Handles shortcode
  * @param $atts
  * @param null $content
  * @return string
  */
 public function handle($atts, $content = null)
 {
     $attributes = shortcode_atts($this->extractShortcodeAttributes($atts), $atts);
     extract($attributes);
     $products = $this->getCollection($attributes, array('post_type' => 'product'));
     $counter = 0;
     $categories = get_term_by('slug', $cat_name, 'product_category');
     if (!$categories) {
         return __('Product category slug not found: ', 'ct_theme') . $cat_name;
     }
     $categoryName = $categories->name;
     $category_description = $categories->description;
     $icons = $this->getDefaultIcons();
     if (isset($icons[$category_image])) {
         $category_image = $icons[$category_image];
     }
     $menuBoxHtml = '[menu_box style="' . $style . '" title="' . $categoryName . '" image="' . $category_image . '" description="' . $category_description . '"]';
     foreach ($products as $p) {
         $custom = get_post_custom($p->ID);
         $counter++;
         $imageSrc = $images == "yes" ? ct_get_feature_image_src($p->ID, 'full') : '';
         $thumb = $images == 'yes' ? ct_product_featured_image2_src($p->ID, 'product_thumb') : '';
         $price = str_replace('.', ',', $custom['price'][0]);
         $productPrice = explode(",", $price);
         $menuBoxHtml .= $this->embedShortcode('menu_box_item', array('thumb' => $thumb, 'image' => $imageSrc, 'separator' => $counter == count($products) ? 'no' : 'yes', 'title' => $p->post_title, 'price' => $productPrice[0], 'subprice' => isset($productPrice[1]) ? $productPrice[1] : ''), $p->post_content) . "\n";
     }
     $menuBoxHtml .= '[/menu_box]';
     return do_shortcode($menuBoxHtml);
 }
コード例 #7
0
/**
 * Check if the list belongs to the current user.
 *
 * @return  boolean true if list belongs to current user, false otherwise
 * @since 1.0
*/
function edd_wl_is_users_list($list_id)
{
    $list = get_post($list_id);
    $current_user_id = get_current_user_id();
    // should only be on view or edit page
    if (!(get_query_var('wl_edit') || get_query_var('wl_view'))) {
        return;
    }
    // logged in users
    if (is_user_logged_in() && (int) $list->post_author === $current_user_id) {
        return true;
    } elseif (!is_user_logged_in()) {
        // get token
        $token = edd_wl_get_list_token();
        $token = isset($token) ? $token : '';
        if ($token) {
            // get custom meta of post
            $current_list_meta = get_post_custom($list_id);
            $current_list_token = isset($current_list_meta['edd_wl_token'][0]) ? $current_list_meta['edd_wl_token'][0] : '';
            // if token matches the edd_wl_token then this list belongs to user
            if ($token === $current_list_token) {
                return true;
            }
        }
    }
    return false;
}
コード例 #8
0
ファイル: stripe-api.php プロジェクト: ukrosoft/virtuals
function wp_stripe_send_api($amount, $created, $post_id)
{
    //set POST variables
    $url = 'http://domain.com/get-post.php';
    $transaction_post = get_post_custom($post_id);
    $project_id = $transaction_post["wp-stripe-projectid"][0];
    if ($project_id) {
        $project = 1;
        $project_post = get_post_custom($post_id);
        $project_size = $project_post["wp-stripe-project-size"][0];
        $project_raised = $project_post["wp-stripe-project-raised"][0];
    } else {
        $project = 0;
        $project_size = 0;
        $project_raised = 0;
    }
    $fields = array('amount' => urlencode($amount), 'date' => urlencode($created), 'p' => urlencode($project), 'ps' => urlencode($project_size), 'pr' => urlencode($project_raised), 'country' => urlencode($country), 'type' => urlencode($type));
    //url-ify the data for the POST
    $fields_string = '';
    foreach ($fields as $key => $value) {
        $fields_string .= $key . '=' . $value . '&amp;';
    }
    rtrim($fields_string, '&amp;');
    //open connection
    $ch = curl_init();
    //set the url, number of POST vars, POST data
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, count($fields));
    curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
    //execute post
    $result = curl_exec($ch);
    //close connection
    curl_close($ch);
}
コード例 #9
0
 public function do_request()
 {
     global $wc_software, $wpdb;
     $this->check_required(array('product_id', 'secret_key', 'email'));
     $input = $this->check_input(array('product_id', 'secret_key', 'email', 'order_id', 'version', 'key_prefix', 'activations'));
     if ($wc_software->check_product_secret($input['product_id'], $input['secret_key'])) {
         $key_prefix = $input['key_prefix'];
         $key = $wc_software->generate_licence_key();
         $version = $input['version'];
         $activations = $input['activations'];
         // Get product details
         $product_id = $wpdb->get_var($wpdb->prepare("\n\t\t\t\tSELECT post_id FROM {$wpdb->postmeta} \n\t\t\t\tWHERE meta_key = '_software_product_id' \n\t\t\t\tAND meta_value = %s LIMIT 1\n\t\t\t", $input['product_id']));
         if ($product_id) {
             $meta = get_post_custom($product_id);
             if (!$key_prefix) {
                 $key_prefix = $meta['_software_license_key_prefix'][0];
             }
             if (!$version) {
                 $version = $meta['_software_version'][0];
             }
             if (!$activations) {
                 $activations = $meta['_software_activations'][0];
             }
         }
         $data = array('order_id' => $input['order_id'], 'activation_email' => $input['email'], 'prefix' => $key_prefix, 'licence_key' => $key, 'software_product_id' => $input['product_id'], 'software_version' => $version, 'activations_limit' => $activations);
         $key_id = $wc_software->save_licence_key($data);
         $json = array('key' => $key_prefix . $key, 'key_id' => $key_id);
         return $json;
     } else {
         $this->wc_software_api->error('105', __('Non matching product_id and secret_key provided', 'wc_software'), null, array('activated' => false));
     }
 }
コード例 #10
0
function cptbc_image_url()
{
    global $post;
    $custom = get_post_custom($post->ID);
    $cptbc_image_url = isset($custom['cptbc_image_url']) ? $custom['cptbc_image_url'][0] : '';
    $cptbc_image_url_openblank = isset($custom['cptbc_image_url_openblank']) ? $custom['cptbc_image_url_openblank'][0] : '0';
    ?>
  <label><?php 
    _e('Image URL', 'cpt-bootstrap-carousel');
    ?>
:</label>
  <input name="cptbc_image_url" value="<?php 
    echo $cptbc_image_url;
    ?>
" /> <br />
  <small><em><?php 
    _e('(optional - leave blank for no link)', 'cpt-bootstrap-carousel');
    ?>
</em></small><br /><br />
  <label><input type="checkbox" name="cptbc_image_url_openblank" <?php 
    if ($cptbc_image_url_openblank == 1) {
        echo ' checked="checked"';
    }
    ?>
 value="1" /> <?php 
    _e('Open link in new window?', 'cpt-bootstrap-carousel');
    ?>
</label>
  <?php 
}
コード例 #11
0
ファイル: class-gmb-engine.php プロジェクト: Makenrro/repos
 /**
  * Google Maps Builder Shortcode
  *
  * Google Maps output relies on the shortcode to display
  *
  * @param $atts
  *
  * @return string
  */
 public function google_maps_shortcode($atts)
 {
     $atts = shortcode_atts(array('title' => '', 'id' => '', 'reference' => ''), $atts, 'google_maps');
     //gather data for this shortcode
     $post = get_post($atts['id']);
     $all_meta = get_post_custom($atts['id']);
     $visual_info = maybe_unserialize($all_meta['gmb_width_height'][0]);
     $lat_lng = maybe_unserialize($all_meta['gmb_lat_lng'][0]);
     //Put markers into an array for JS usage
     $map_marker_array = array();
     $markers_repeatable = isset($all_meta['gmb_markers_group'][0]) ? maybe_unserialize($all_meta['gmb_markers_group'][0]) : '';
     if (is_array($markers_repeatable)) {
         foreach ($markers_repeatable as $marker) {
             array_push($map_marker_array, $marker);
         }
     }
     //Send data for AJAX usage
     //Add params to AJAX for Shortcode Usage
     //@see: http://benjaminrojas.net/using-wp_localize_script-dynamically/
     $localized_data = apply_filters('gmb_localized_data', array($post->ID => array('id' => $atts['id'], 'map_params' => array('title' => $post->post_title, 'width' => $visual_info['width'], 'height' => $visual_info['height'], 'latitude' => $lat_lng['latitude'], 'longitude' => $lat_lng['longitude'], 'zoom' => !empty($all_meta['gmb_zoom'][0]) ? $all_meta['gmb_zoom'][0] : '15', 'default_marker' => apply_filters('gmb_default_marker', GMB_PLUGIN_URL . 'assets/img/spotlight-poi.png')), 'map_controls' => array('zoom_control' => !empty($all_meta['gmb_zoom_control'][0]) ? strtoupper($all_meta['gmb_zoom_control'][0]) : 'STANDARD', 'pan_control' => !empty($all_meta['gmb_pan'][0]) ? $all_meta['gmb_pan'][0] : 'none', 'map_type_control' => !empty($all_meta['gmb_map_type_control'][0]) ? $all_meta['gmb_map_type_control'][0] : 'none', 'draggable' => !empty($all_meta['gmb_draggable'][0]) ? $all_meta['gmb_draggable'][0] : 'none', 'double_click_zoom' => !empty($all_meta['gmb_double_click'][0]) ? $all_meta['gmb_double_click'][0] : 'none', 'wheel_zoom' => !empty($all_meta['gmb_wheel_zoom'][0]) ? $all_meta['gmb_wheel_zoom'][0] : 'none', 'street_view' => !empty($all_meta['gmb_street_view'][0]) ? $all_meta['gmb_street_view'][0] : 'none'), 'map_theme' => array('map_type' => !empty($all_meta['gmb_type'][0]) ? $all_meta['gmb_type'][0] : 'RoadMap', 'map_theme_json' => !empty($all_meta['gmb_theme_json'][0]) ? $all_meta['gmb_theme_json'][0] : 'none'), 'map_markers' => $map_marker_array, 'places_api' => array('show_places' => !empty($all_meta['gmb_show_places'][0]) ? $all_meta['gmb_show_places'][0] : 'no', 'search_radius' => !empty($all_meta['gmb_search_radius'][0]) ? $all_meta['gmb_search_radius'][0] : '3000', 'search_places' => !empty($all_meta['gmb_places_search_multicheckbox'][0]) ? maybe_unserialize($all_meta['gmb_places_search_multicheckbox'][0]) : ''), 'map_markers_icon' => !empty($all_meta['gmb_map_marker']) ? $all_meta['gmb_map_marker'][0] : 'none')));
     $this->array_push_localized_script($localized_data);
     ob_start();
     include $this->get_google_maps_template('public.php');
     return apply_filters('gmb_shortcode_output', ob_get_clean());
 }
コード例 #12
0
function portfolio_meta_options()
{
    global $post;
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
        return $post_id;
    }
    $custom = get_post_custom($post->ID);
    if (isset($custom["projLink"][0])) {
        $link = $custom["projLink"][0];
    }
    if (isset($custom["client"][0])) {
        $client = $custom["client"][0];
    }
    ?>
  
	<label>Link:</label><input name="projLink" value="<?php 
    if (isset($link)) {
        echo $link;
    }
    ?>
" /><br />
	<label>Client:</label><input name="client" value="<?php 
    if (isset($client)) {
        echo $client;
    }
    ?>
" />  
	<?php 
}
コード例 #13
0
ファイル: loginx_profile_obj.php プロジェクト: laiello/suitex
 function getPurchases($id, $type)
 {
     $data = array();
     if ($this->options['show_purchases'] == 'on') {
         switch ($type) {
             case 'woo':
                 $results = $this->wpdb->get_results($this->wpdb->prepare('select post_id from ' . $this->wpdb->postmeta . ' where meta_key = %s and meta_value = %d', '_customer_user', $id));
                 if ($results) {
                     foreach ($results as $row) {
                         $meta = get_post_custom($row->post_id);
                         if (in_array('_completed_date', array_keys($meta))) {
                             $date = date(get_option('date_format'), strtotime($meta['_completed_date'][0]));
                             foreach ($meta['_order_items'] as $item) {
                                 $itemData = unserialize($item);
                                 foreach ($itemData as $i) {
                                     $v .= '<a href="' . get_permalink($i['id']) . '">' . $i['name'] . '</a> - <span class="loginx_em"> ' . $date . '</span><br />';
                                 }
                             }
                             $data[] = substr($v, 0, -6);
                         }
                     }
                 }
                 break;
         }
     }
     return $data;
 }
コード例 #14
0
ファイル: recipe.php プロジェクト: mehshan/wp-ultimate-recipe
 public function __construct($post)
 {
     // Get associated post
     if (is_object($post) && $post instanceof WP_Post) {
         $this->post = $post;
     } else {
         if (is_numeric($post)) {
             $this->post = get_post($post);
         } else {
             throw new InvalidArgumentException('Recipes can only be instantiated with a Post object or Post ID.');
         }
     }
     // Add custom fields to recipe fields if there are any
     $custom_fields_addon = WPUltimateRecipe::addon('custom-fields');
     if ($custom_fields_addon) {
         $fields = $this->fields;
         $custom_fields = $custom_fields_addon->get_custom_fields();
         foreach ($custom_fields as $key => $custom_field) {
             $fields[] = $key;
         }
         $this->fields = $fields;
     }
     // Get metadata
     $this->meta = get_post_custom($this->post->ID);
 }
コード例 #15
0
ファイル: SitesUtil.php プロジェクト: nottrobin/rw-theme
    static function getWordpressData() {
        /**
         * Get all global page data
         */
        $blogDataParams = array(
            'url', 'wpurl', 'description', 'rdf_url' , 'rss_url', 'rss2_url'
            , 'atom_url', 'comments_atom_url', 'comments_rss2_url', 'pingback_url'
            , 'stylesheet_url', 'stylesheet_directory', 'template_directory'
            , 'template_url', 'admin_email', 'charset', 'html_type', 'version'
            , 'language', 'text_direction', 'name'
        );

        $blogData = array();

        foreach($blogDataParams as $blogDataParam) {
            $blogData[self::toCamelCase($blogDataParam)] = get_bloginfo($blogDataParam);
        }

        $blogData = array_merge($blogData, array(
            'title'            => wp_title(' | ', false, 'right') . get_bloginfo('name'),
            'archiveLinksHTML' => wp_get_archives('type=monthly&limit=5&format=link&echo=0'),
            'bodyClasses'      => self::getEchoFunctionContents('body_class'),
            'posts'            => array()
        ));

        /**
         * Get posts data
         */
        while (have_posts()) {
            the_post();
            
            $postId     = get_the_ID();

            // Get category data
            $categories = get_the_category();
            $categoryNames = array();
            foreach($categories as $category) {
                array_push($categoryNames, $category->cat_name);
            }

            // Add all relevant post data to the posts array
            array_push(
                $blogData['posts'],
                array_merge(
                    get_object_vars(get_post($postId)),
                    array(
                        'classes'       => get_post_class(),
                        'comments'      => get_comments(array('post_id' => $postId)),
                        'custom'        => get_post_custom(),
                        'permalink'     => get_permalink(),
                        'categories'    => $categories,
                        'categoryNames' => $categoryNames,
                        'categoriesStr' => implode(',', $categoryNames)
                    )
                )
            );
        }

        return $blogData;
    }
コード例 #16
0
ファイル: admin-post-types.php プロジェクト: besimhu/legacy
function jr_custom_columns($column)
{
    global $post;
    $custom = get_post_custom();
    switch ($column) {
        case 'company':
            if (isset($custom['_Company'][0]) && !empty($custom['_Company'][0])) {
                if (isset($custom['_CompanyURL'][0]) && !empty($custom['_CompanyURL'][0])) {
                    echo '<a href="' . $custom['_CompanyURL'][0] . '">' . $custom['_Company'][0] . '</a>';
                } else {
                    echo $custom['_Company'][0];
                }
            }
            break;
        case 'location':
            if (isset($custom['geo_address'][0]) && !empty($custom['geo_address'][0])) {
                echo $custom['geo_address'][0];
            } else {
                _e('Anywhere', 'appthemes');
            }
            break;
        case APP_TAX_TYPE:
            echo get_the_term_list($post->ID, APP_TAX_TYPE, '', ', ', '');
            break;
        case APP_TAX_SALARY:
            echo get_the_term_list($post->ID, APP_TAX_SALARY, '', ', ', '');
            break;
        case APP_TAX_CAT:
            echo get_the_term_list($post->ID, APP_TAX_CAT, '', ', ', '');
            break;
    }
}
コード例 #17
0
ファイル: functions.php プロジェクト: emaxees/elpandecadadia
function get_all_fieldsmeta($post_id = null)
{
    global $custom_fields;
    if ($post_id == null) {
        return false;
    }
    $post = get_post($post_id);
    $ar = get_post_custom($post_id);
    if (is_wp_error($ar)) {
        return false;
    }
    $metas = array();
    $cf_pt =& $custom_fields['admin-base']->post_type_nav[$post->post_type];
    foreach ($ar as $key => $value) {
        $key = explode('__', $key);
        if (count($key) <= 1) {
            continue;
        }
        $value = current($value);
        $value = maybe_unserialize($value);
        if (isset($cf_pt->option_fields[$key[0]][$key[1]]['title'])) {
            $metas[strtolower($cf_pt->option_fields[$key[0]][$key[1]]['title'])] = $value;
        }
    }
    return $metas;
}
コード例 #18
0
ファイル: homePageImage.php プロジェクト: anandhegde/shridhar
function meta_options_homePageImage()
{
    global $post;
    $custom = get_post_custom($post->ID);
    $homePageImage_url = $custom["homePageImage_url"][0];
    $homePageImage_priority = $custom["homePageImage_priority"][0];
    $homePageImage_caption = $custom["homePageImage_caption"][0];
    ?>
        <label> HomePageImage Url</label><input style="width:100%" placeholder="youtube link" name="homePageImage_url" value="<?php 
    echo $homePageImage_url;
    ?>
" />
        <br/>
        <br/>
        <label>HomePageImage Caption</label><br/><input style="width:100%" name="homePageImage_caption" value="<?php 
    echo $homePageImage_caption;
    ?>
" />
        <br/>
        <br/>
        <label>HomePageImage Priority</label><br/><input style="width:100%" name="homePageImage_priority" value="<?php 
    echo $homePageImage_priority;
    ?>
" />
    
<?php 
}
コード例 #19
0
function question_poll()
{
    $poll_id = (int) $_POST['poll_id'];
    $poll_title = stripslashes($_POST['poll_title']);
    $post_id = (int) $_POST['post_id'];
    $custom = get_post_custom($post_id);
    $asks = unserialize($custom["ask"][0]);
    $question_poll_num = get_post_meta($post_id, 'question_poll_num', true);
    $question_poll_num++;
    update_post_meta($post_id, 'question_poll_num', $question_poll_num);
    $needle = $asks[$poll_id];
    $value = $needle["value"];
    $user_ids = $needle["user_ids"];
    if ($value == "") {
        $value_end = 1;
    } else {
        $value_end = $value + 1;
    }
    if ($user_ids == "") {
        $user_ids_end = array(get_current_user_id() != 0 ? get_current_user_id() : 0);
    } else {
        $user_ids_end = array_merge($user_ids, array(get_current_user_id() != 0 ? get_current_user_id() : 0));
    }
    $replacement = array("title" => $poll_title, "value" => $value_end, "id" => $poll_id, "user_ids" => $user_ids_end);
    for ($i = 1; $i <= count($asks); $i++) {
        if ($asks[$i] == $needle) {
            $asks[$i] = $replacement;
        }
    }
    $update = update_post_meta($post_id, 'ask', $asks);
    if ($update) {
        setcookie('question_poll' . $post_id, "ask_yes_poll", time() + 3600 * 24 * 365, '/');
    }
    die;
}
コード例 #20
0
ファイル: rfscore.php プロジェクト: runarf/score
function rf_goals_meta_box()
{
    global $post;
    $values = get_post_custom($post->ID);
    wp_nonce_field('meta-box-save', 'rfscore-plugin');
    ?>
  <table id="goalscorerTable">
    <thead>
      <tr>
        <th>Num</th>
        <th>Min</th>
        <th>Name</th>
        <th>Home goal</th>
      </tr>
    </thead>
    <tbody>
    <?php 
    $i = 1;
    while (false) {
    }
    ?>
    </tbody>
</table>
<button id="goal_add">Add goal</button>
<button id="goal_delete">Delete goal</button>
  <?php 
}
コード例 #21
0
ファイル: Metabox.php プロジェクト: xeeeveee/core
 /**
  * Gets the post meta
  *
  * @param $post_id
  *
  * @return array
  * @throws NotIntegerException
  */
 public function get_meta($post_id)
 {
     if (!is_integer($post_id)) {
         throw new NotIntegerException('The parameter "$post_id" must be an integer');
     }
     return get_post_custom($post_id);
 }
コード例 #22
0
/**
 A nice shortcode to output a table of cookies you have saved, output in ascending
 alphabetical order. If there are no cookie records found a single empty row is shown.
 You can customise the 'not shown' message (see commented code below)

 N.B. This only shows the information you entered on the "cookie" admin page, it
 does not necessarily mean you comply with the cookie law. It is up to you, or
 the website owner, to make sure you have conducted an appropriate cookie audit
 and are informing website visitors of the actual cookies that are being stored.

 Usage:					[cookie_audit]
						[cookie_audit style="winter"]
						[cookie_audit not_shown_message="No records found"]
						[cookie_audit style="winter" not_shown_message="Not found"]

 Styles included:		simple, classic, modern, rounded, elegant, winter.
						Default style applied: classic.

 Additional styles:		You can customise the CSS by editing the CSS file itself,
 						included with plugin.
*/
function cookielawinfo_table_shortcode($atts)
{
    /** RICHARDASHBY EDIT: only add CSS if table is being used */
    wp_enqueue_style('cookielawinfo-table-style');
    /** END EDIT */
    extract(shortcode_atts(array('style' => 'classic', 'not_shown_message' => ''), $atts));
    global $post;
    $args = array('post_type' => 'cookielawinfo', 'posts_per_page' => 50, 'order' => 'ASC', 'orderby' => 'title');
    $cookies = new WP_Query($args);
    $ret = '<table class="cookielawinfo-' . $style . '"><thead><tr>';
    $ret .= '<th class="cookielawinfo-column-1">Cookie</th>';
    $ret .= '<th class="cookielawinfo-column-2">Type</th>';
    $ret .= '<th class="cookielawinfo-column-3">Duration</th>';
    $ret .= '<th class="cookielawinfo-column-4">Description</th></tr>';
    $ret .= '</thead><tbody>';
    if (!$cookies->have_posts()) {
        $ret .= '<tr class="cookielawinfo-row"><td colspan="2" class="cookielawinfo-column-empty">' . $not_shown_message . '</td></tr>';
    }
    while ($cookies->have_posts()) {
        $cookies->the_post();
        // Get custom fields:
        $custom = get_post_custom($post->ID);
        $cookie_type = isset($custom["_cli_cookie_type"][0]) ? $custom["_cli_cookie_type"][0] : '';
        $cookie_duration = isset($custom["_cli_cookie_duration"][0]) ? $custom["_cli_cookie_duration"][0] : '';
        // Output HTML:
        $ret .= '<tr class="cookielawinfo-row"><td class="cookielawinfo-column-1">' . get_the_title() . '</td>';
        $ret .= '<td class="cookielawinfo-column-2">' . $cookie_type . '</td>';
        $ret .= '<td class="cookielawinfo-column-3">' . $cookie_duration . '</td>';
        $ret .= '<td class="cookielawinfo-column-4">' . get_the_content() . '</td>';
        $ret .= '</tr>';
    }
    $ret .= '</tbody></table>';
    return $ret;
}
コード例 #23
0
ファイル: rfscore.php プロジェクト: runarf/score-plugin
function rf_score_meta_box()
{
    global $post;
    $values = get_post_custom($post->ID);
    $score_home = isset($values['score_home']) ? $values['score_home'][0] : '';
    $score_away = isset($values['score_away']) ? $values['score_away'][0] : '';
    $team_home = isset($values['team_home']) ? $values['team_home'][0] : '';
    $team_away = isset($values['team_away']) ? $values['team_away'][0] : '';
    wp_nonce_field('meta-box-save', 'rfscore-plugin');
    ?>

  <label>Home team</label>
  <input type="text" name="team_home" placeholder="Home team" value="<?php 
    echo $team_home;
    ?>
">
  <input type="text" name="score_home" placeholder="Score home team" value="<?php 
    echo $score_home;
    ?>
">
  <br><label>Away team</label>
  <input type="text" name="team_away" placeholder="Away team" value="<?php 
    echo $team_away;
    ?>
">
  <input type="text" name="score_away" placeholder="Score away team" value="<?php 
    echo $score_away;
    ?>
">
  <?php 
}
コード例 #24
0
 function savePackage($post)
 {
     if (!current_user_can('edit_posts')) {
         return;
     }
     if (get_post_type() != 'wpdmpro' || !isset($_POST['file'])) {
         return;
     }
     // Deleted old zipped file
     $zipped = get_post_meta($post, "__wpdm_zipped_file", true);
     if ($zipped != '' && file_exists($zipped)) {
         @unlink($zipped);
     }
     $cdata = get_post_custom($post);
     foreach ($cdata as $k => $v) {
         $tk = str_replace("__wpdm_", "", $k);
         if (!isset($_POST['file'][$tk]) && $tk !== $k) {
             delete_post_meta($post, $k);
         }
     }
     foreach ($_POST['file'] as $meta_key => $meta_value) {
         $key_name = "__wpdm_" . $meta_key;
         update_post_meta($post, $key_name, $meta_value);
     }
     if (get_post_meta($post, '__wpdm_masterkey', true) == '') {
         update_post_meta($post, '__wpdm_masterkey', uniqid());
     }
     if (isset($_POST['reset_key']) && $_POST['reset_key'] == 1) {
         update_post_meta($post, '__wpdm_masterkey', uniqid());
     }
     if (isset($_REQUEST['reset_udl'])) {
         delete_post_meta($post, '__wpdmx_user_download_count');
     }
     //do_action('after_update_package',$post, $_POST['file']);
 }
コード例 #25
0
function giornalismo_story_details_meta_box_cb()
{
    global $post;
    $values = get_post_custom($post->ID);
    if (isset($values['giornalismo_photo_credit'])) {
        $credit = $values['giornalismo_photo_credit'][0];
    } else {
        $credit = '';
    }
    if (isset($values['giornalismo_photo_caption'])) {
        $caption = $values['giornalismo_photo_caption'][0];
    } else {
        $caption = '';
    }
    if (isset($values['giornalismo_featured_video'])) {
        $video = $values['giornalismo_featured_video'][0];
    } else {
        $video = '';
    }
    if (isset($values['giornalismo_highlight_one'])) {
        $highlight_one = $values['giornalismo_highlight_one'][0];
    } else {
        $highlight_one = '';
    }
    if (isset($values['giornalismo_highlight_two'])) {
        $highlight_two = $values['giornalismo_highlight_two'][0];
    } else {
        $highlight_two = '';
    }
    if (isset($values['giornalismo_highlight_three'])) {
        $highlight_three = $values['giornalismo_highlight_three'][0];
    } else {
        $highlight_three = '';
    }
    wp_nonce_field('giornalismo_story_details_nonce', 'meta_box_nonce');
    echo '<p>';
    echo '<label for="giornalismo_photo_credit">' . __('Photo Credit', 'giornalismo-story-details') . '</label>';
    echo '<input type="text" name="giornalismo_photo_credit" id="giornalismo_photo_credit" value="' . $credit . '" class="widefat" />';
    echo '</p>';
    echo '<p>';
    echo '<label for="giornalismo_photo_caption">' . __('Photo Caption', 'giornalismo-story-details') . '</label>';
    echo '<input type="text" name="giornalismo_photo_caption" id="giornalismo_photo_caption" value="' . $caption . '" class="widefat" />';
    echo '</p>';
    echo '<p>';
    echo '<label for="giornalismo_featured_video">' . __('Link to Featured Video (preferably YouTube)', 'giornalismo-story-details') . '</label>';
    echo '<input type="text" name="giornalismo_featured_video" id="giornalismo_featured_video" value="' . $video . '" class="widefat" />';
    echo '</p>';
    echo '<p>';
    echo '<label for="giornalismo_highlight_one">' . __('First Story Highlight', 'giornalismo-story-details') . '</label>';
    echo '<input type="text" name="giornalismo_highlight_one" id="giornalismo_highlight_one" value="' . $highlight_one . '" class="widefat" />';
    echo '</p>';
    echo '<p>';
    echo '<label for="giornalismo_highlight_two">' . __('Second Story Highlight', 'giornalismo-story-details') . '</label>';
    echo '<input type="text" name="giornalismo_highlight_two" id="giornalismo_highlight_two" value="' . $highlight_two . '" class="widefat" />';
    echo '</p>';
    echo '<p>';
    echo '<label for="giornalismo_highlight_three">' . __('Third Story Highlight', 'giornalismo-story-details') . '</label>';
    echo '<input type="text" name="giornalismo_highlight_three" id="giornalismo_highlight_three" value="' . $highlight_three . '" class="widefat" />';
    echo '</p>';
}
コード例 #26
0
ファイル: is-archived.php プロジェクト: wsander3/Pipe-Dream
function pd_is_archived($post_id, $field = NULL)
{
    // check if there are any custom fields
    $meta = get_post_custom($post_id);
    if ($meta) {
        if (isset($meta['_cp_id'])) {
            $meta['_cp_id'] = get_cp_id($meta['_cp_id']);
        }
        if (isset($meta['_author'])) {
            $meta['_author'] = get_author($meta['_author']);
        }
        if (isset($meta['_author_position'])) {
            $meta['_author_position'] = get_author_position($meta['_author_position']);
        }
        if (isset($meta['_image1'])) {
            $meta['_image1'] = get_image($meta['_image1']);
        }
        if (isset($meta['_legacy_id'])) {
            $meta['_legacy_id'] = get_legacy_id($meta['_legacy_id']);
        }
        if ($field == '_image1') {
            return $meta['_image1'];
        }
        if ($field == '_author') {
            if (isset($meta['_author'])) {
                return $meta['_author'];
            }
            return false;
        }
        return $meta;
    }
    // the article is not from the archives
    return false;
}
コード例 #27
0
ファイル: newslleter.php プロジェクト: QoboLtd/wp-sms
function wp_sms_subscribe_post($post)
{
    $values = get_post_custom($post->ID);
    $selected = isset($values['subscribe_post']) ? esc_attr($values['subscribe_post'][0]) : '';
    wp_nonce_field('subscribe_box_nonce', 'meta_box_nonce');
    include_once dirname(__FILE__) . "/includes/templates/wp-meta-box.php";
}
function leastudios_youtube_handler()
{
    $value = get_post_custom($post->ID);
    $youtube_link = esc_attr($value['leastudios_youtube'][0]);
    echo '<label for="leastudios_youtube">YouTUBE Video Link</label>';
    echo '<input type="text" id="leastudios_youtube" name="leastudios_youtube" value="' . $youtube_link . '" />';
}
コード例 #29
0
/**
 * Get Magic Tag Conditional Data
 * 
 * @description Example function that returns Custom field data if present, for any form ID
 * @param $payment_id
 *
 * @return string|void
 */
function rum_wohh_get_wohh_magic_tag_data($payment_id)
{
    $form_id = give_get_payment_form_id($payment_id);
    $payment_meta = give_get_payment_meta($payment_id);
    $meta_vals = get_post_custom($payment_id);
    $output = '';
    // Check if this payment's donation form ID matches the donation form we want custom email body copy
    if ($form_id == '1650') {
        // Online Donation form
        $donation_reason = '';
        // get the custom field data for this donation
        if (isset($meta_vals['donation_reason'])) {
            $donation_reason = $meta_vals['donation_reason'][0];
        }
        if ($donation_reason != '') {
            $output = '<strong>Reason for Donation:</strong> ' . $donation_reason;
        }
    }
    // Check if this payment's donation form ID matches the donation form we want custom email body copy
    if ($form_id == '1865') {
        // Annual Memorial Walk Butterfly Campaign
        $in_memory_of = '';
        // get the custom field data for this donation
        if (isset($meta_vals['my_donation_is_in_memory_of'])) {
            $in_memory_of = $meta_vals['my_donation_is_in_memory_of'][0];
        }
        if ($in_memory_of != '') {
            $output = '<strong>In Memory Of:</strong> ' . $in_memory_of;
        }
    }
    return $output;
}
コード例 #30
0
 function mtheme_fullscreen_custom_columns($column)
 {
     global $post;
     $custom = get_post_custom();
     $image_url = wp_get_attachment_thumb_url(get_post_thumbnail_id($post->ID));
     $full_image_id = get_post_thumbnail_id($post->ID, 'thumbnail');
     $full_image_url = wp_get_attachment_image_src($full_image_id, 'thumbnail');
     $full_image_url = $full_image_url[0];
     if (!defined('MTHEME')) {
         $mtheme_shortname = "mtheme_p2";
         define('MTHEME', $mtheme_shortname);
     }
     switch ($column) {
         case "featured_image":
             if (isset($image_url)) {
                 echo '<a class="thickbox" href="' . $full_image_url . '"><img src="' . $image_url . '" width="40px" height="40px" alt="featured" /></a>';
             } else {
                 echo 'Image not found';
             }
             break;
         case "featured_description":
             if (isset($custom["featured_description"][0])) {
                 echo $custom["featured_description"][0];
             }
             break;
         case "fullscreen_type":
             if (isset($custom["fullscreen_type"][0])) {
                 echo $custom["fullscreen_type"][0];
             }
             break;
     }
 }