Esempio n. 1
0
 function get_post_format_link_content($pagebuilder = false)
 {
     /* needed variables */
     $urlfound = false;
     $url = '';
     $content = get_the_content();
     /* retrieve meta data */
     $value = lambda_return_meta('postformat');
     /* check if there is an url inside the meta */
     if (!empty($value['_format_link_url'])) {
         $url = lambda_translate_meta($value['_format_link_url']);
         /* set url found */
         $urlfound = true;
     }
     /* there is no url inside the meta , lets check the content*/
     if (!$urlfound) {
         /* try to fetch a link */
         $url = post_format_url_grabber($content);
     }
     /* do not return the link since the pagebuilder has a different markup */
     if (!$pagebuilder) {
         return !empty($url) ? $url : '#';
     }
 }
 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;
         }
     }
 }