コード例 #1
0
ファイル: functions.php プロジェクト: amptdesign/ampt-2016
 function ut_get_sidebar_settings()
 {
     /* create sidebar settings array */
     $sidebar_settings = array();
     /* assign primary sidebar */
     $sidebar_settings['primary_sidebar'] = ut_return_meta('ut_select_sidebar');
     /* return sidebar config */
     return $sidebar_settings;
 }
コード例 #2
0
 function get_post_format_image_url()
 {
     /* needed variables */
     $imagefound = false;
     $image = '';
     /* retrieve meta data */
     $value = ut_return_meta('postformat');
     /* check if we have a image inside the default wordpress meta */
     if (!empty($value['_format_image'])) {
         return $value['_format_image'];
     }
     /* there is no image inside the meta, so lets check the post has image childs */
     if (!$imagefound) {
         /* get an array of images */
         $images = get_children(array('post_parent' => get_the_ID(), 'post_type' => 'attachment', 'post_mime_type' => 'image', 'numberposts' => -1));
         /* run trough images and send back the first image we have found */
         foreach ($images as $image) {
             /* we check if we are an image already aotherwise set it*/
             if (!$imagefound) {
                 return $image->guid;
             }
         }
     }
     /* there are still no images, so lets check for linked images inside the content */
     if (!$imagefound) {
         $content = get_the_content();
         $image = post_format_url_grabber($content);
         if (!empty($image)) {
             return $image;
         }
     }
 }