本文整理汇总了PHP中RevSliderFunctionsWP::getPostThumbID方法的典型用法代码示例。如果您正苦于以下问题:PHP RevSliderFunctionsWP::getPostThumbID方法的具体用法?PHP RevSliderFunctionsWP::getPostThumbID怎么用?PHP RevSliderFunctionsWP::getPostThumbID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RevSliderFunctionsWP
的用法示例。
在下文中一共展示了RevSliderFunctionsWP::getPostThumbID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initByPostData
/**
*
* init slide by post data
*/
public function initByPostData($postData, RevSliderSlide $slideTemplate, $sliderID)
{
$this->postData = $postData;
$postID = $postData["ID"];
$slideTemplateID = get_post_meta($postID, 'slide_template', true);
if ($slideTemplateID == '') {
$slideTemplateID = 'default';
}
if (!empty($slideTemplateID) && is_numeric($slideTemplateID)) {
//init by local template, if fail, init by global (slider) template
try {
$slideTemplateLocal = new RevSliderSlide();
$slideTemplateLocal->initByID($slideTemplateID);
$this->initBySlide($slideTemplateLocal);
} catch (Exception $e) {
$this->initBySlide($slideTemplate);
}
} else {
//init by global template
$this->initBySlide($slideTemplate);
}
//set some slide params
$this->id = $postID;
$this->params["title"] = RevSliderFunctions::getVal($postData, "post_title");
if (isset($this->params['enable_link']) && $this->params['enable_link'] == "true" && isset($this->params['link_type']) && $this->params['link_type'] == "regular") {
$link = get_permalink($postID);
$this->params["link"] = str_replace(array("%link%", '{{link}}'), $link, $this->params["link"]);
$this->params["link"] = str_replace('-', '_REVSLIDER_', $this->params["link"]);
//process meta tags:
$arrMatches = array();
preg_match('/%meta:\\w+%/', $this->params["link"], $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);
$this->params["link"] = str_replace($match, $metaValue, $this->params["link"]);
}
$arrMatches = array();
preg_match('/{{meta:\\w+}}/', $this->params["link"], $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);
$this->params["link"] = str_replace($match, $metaValue, $this->params["link"]);
}
$this->params["link"] = str_replace('_REVSLIDER_', '-', $this->params["link"]);
}
$status = $postData["post_status"];
if ($status == "publish") {
$this->params["state"] = "published";
} else {
$this->params["state"] = "unpublished";
}
if ($this->params["background_type"] == 'image') {
//if image is choosen, use featured image as background
//set image
$thumbID = RevSliderFunctionsWP::getPostThumbID($postID);
if (!empty($thumbID)) {
$this->setImageByImageID($thumbID);
}
}
//replace placeholders in layers:
$this->setLayersByPostData($postData, $sliderID);
}