当前位置: 首页>>代码示例>>PHP>>正文


PHP UniteFunctionsWPRev::getExcerptById方法代码示例

本文整理汇总了PHP中UniteFunctionsWPRev::getExcerptById方法的典型用法代码示例。如果您正苦于以下问题:PHP UniteFunctionsWPRev::getExcerptById方法的具体用法?PHP UniteFunctionsWPRev::getExcerptById怎么用?PHP UniteFunctionsWPRev::getExcerptById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UniteFunctionsWPRev的用法示例。


在下文中一共展示了UniteFunctionsWPRev::getExcerptById方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setLayersByPostData

 /**
  * 
  * replace layer placeholders by post data
  */
 private function setLayersByPostData($postData, $sliderID)
 {
     $postID = $postData["ID"];
     $title = UniteFunctionsRev::getVal($postData, "post_title");
     $excerpt_limit = $this->getSliderParam($sliderID, "excerpt_limit", 55, RevSlider::VALIDATE_NUMERIC);
     $excerpt_limit = (int) $excerpt_limit;
     $excerpt = UniteFunctionsWPRev::getExcerptById($postID, $excerpt_limit);
     $alias = UniteFunctionsRev::getVal($postData, "post_name");
     $content = UniteFunctionsRev::getVal($postData, "post_content");
     $link = get_permalink($postID);
     $postDate = UniteFunctionsRev::getVal($postData, "post_date_gmt");
     $postDate = UniteFunctionsWPRev::convertPostDate($postDate);
     $dateModified = UniteFunctionsRev::getVal($postData, "post_modified");
     $dateModified = UniteFunctionsWPRev::convertPostDate($dateModified);
     $authorID = UniteFunctionsRev::getVal($postData, "post_author");
     $authorName = UniteFunctionsWPRev::getUserDisplayName($authorID);
     $postCatsIDs = $postData["post_category"];
     $catlist = UniteFunctionsWPRev::getCategoriesHtmlList($postCatsIDs);
     $taglist = UniteFunctionsWPRev::getTagsHtmlList($postID);
     $numComments = UniteFunctionsRev::getVal($postData, "comment_count");
     foreach ($this->arrLayers as $key => $layer) {
         $text = UniteFunctionsRev::getVal($layer, "text");
         $text = str_replace("%title%", $title, $text);
         $text = str_replace("%excerpt%", $excerpt, $text);
         $text = str_replace("%alias%", $alias, $text);
         $text = str_replace("%content%", $content, $text);
         $text = str_replace("%link%", $link, $text);
         $text = str_replace("%date%", $postDate, $text);
         $text = str_replace("%date_modified%", $dateModified, $text);
         $text = str_replace("%author_name%", $authorName, $text);
         $text = str_replace("%num_comments%", $numComments, $text);
         $text = str_replace("%catlist%", $catlist, $text);
         $text = str_replace("%taglist%", $taglist, $text);
         //process meta tags:
         $arrMatches = array();
         $text = str_replace('-', '_REVSLIDER_', $text);
         preg_match('/%meta:\\w+%/', $text, $arrMatches);
         foreach ($arrMatches as $match) {
             $meta = str_replace("%meta:", "", $match);
             $meta = str_replace("%", "", $meta);
             $meta = str_replace('_REVSLIDER_', '-', $meta);
             $metaValue = get_post_meta($postID, $meta, true);
             $text = str_replace($match, $metaValue, $text);
         }
         $text = str_replace('_REVSLIDER_', '-', $text);
         //replace event's template
         if (UniteEmRev::isEventsExists()) {
             $eventData = UniteEmRev::getEventPostData($postID);
             if (!empty($eventData)) {
                 foreach ($eventData as $eventKey => $eventValue) {
                     $eventPlaceholder = "%event_" . $eventKey . "%";
                     if ($eventKey == 'start_date' || $eventKey == 'end_date') {
                         $eventValue = UniteFunctionsWPRev::convertPostDate($eventValue);
                     }
                     $text = str_replace($eventPlaceholder, $eventValue, $text);
                 }
             }
         }
         //$text = str_replace("location", "maxim" , $text);
         $layer["text"] = $text;
         $this->arrLayers[$key] = $layer;
     }
     //$allMeta = get_post_meta($postID);
     //dmp($allMeta);exit();
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:69,代码来源:revslider_slide.class.php


注:本文中的UniteFunctionsWPRev::getExcerptById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。