本文整理汇总了PHP中RevSliderFunctionsWP::getExcerptById方法的典型用法代码示例。如果您正苦于以下问题:PHP RevSliderFunctionsWP::getExcerptById方法的具体用法?PHP RevSliderFunctionsWP::getExcerptById怎么用?PHP RevSliderFunctionsWP::getExcerptById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RevSliderFunctionsWP
的用法示例。
在下文中一共展示了RevSliderFunctionsWP::getExcerptById方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setLayersByPostData
/**
*
* replace layer placeholders by post data
*/
private function setLayersByPostData($postData, $sliderID)
{
$postID = $postData["ID"];
$attr = array();
$attr['title'] = RevSliderFunctions::getVal($postData, "post_title");
$excerpt_limit = $this->getSliderParam($sliderID, "excerpt_limit", 55, RevSlider::VALIDATE_NUMERIC);
$excerpt_limit = (int) $excerpt_limit;
$attr['excerpt'] = RevSliderFunctionsWP::getExcerptById($postID, $excerpt_limit);
$attr['alias'] = RevSliderFunctions::getVal($postData, "post_name");
$attr['content'] = RevSliderFunctions::getVal($postData, "post_content");
$attr['link'] = get_permalink($postID);
$postDate = RevSliderFunctions::getVal($postData, "post_date_gmt");
$attr['postDate'] = RevSliderFunctionsWP::convertPostDate($postDate);
$dateModified = RevSliderFunctions::getVal($postData, "post_modified");
$attr['dateModified'] = RevSliderFunctionsWP::convertPostDate($dateModified);
$authorID = RevSliderFunctions::getVal($postData, "post_author");
$attr['authorName'] = RevSliderFunctionsWP::getUserDisplayName($authorID);
$postCatsIDs = $postData["post_category"];
$attr['catlist'] = RevSliderFunctionsWP::getCategoriesHtmlList($postCatsIDs);
$attr['taglist'] = RevSliderFunctionsWP::getTagsHtmlList($postID);
$ptid = get_post_thumbnail_id($postID);
$img_sizes = RevSliderBase::get_all_image_sizes();
$attr['img_urls'] = array();
foreach ($img_sizes as $img_handle => $img_name) {
$featured_image_url = wp_get_attachment_image_src($ptid, $img_handle);
if ($featured_image_url !== false) {
$attr['img_urls'][$img_handle] = array('url' => $featured_image_url[0], 'tag' => '<img src="' . $featured_image_url[0] . '" width="' . $featured_image_url[1] . '" height="' . $featured_image_url[2] . '" data-no-retina />');
}
}
$numComments = RevSliderFunctions::getVal($postData, "comment_count");
foreach ($this->arrLayers as $key => $layer) {
$text = RevSliderFunctions::getVal($layer, "text");
$text = apply_filters('revslider_mod_meta', $text, $postID, $postData);
//option to add your own filter here to modify meta to your likings
$text = $this->set_post_data($text, $attr, $postID);
$layer["text"] = $text;
$all_actions = RevSliderFunctions::getVal($layer, 'layer_action', array());
if (!empty($all_actions)) {
$a_image_link = RevSliderFunctions::cleanStdClassToArray(RevSliderFunctions::getVal($all_actions, 'image_link', array()));
if (!empty($a_image_link)) {
foreach ($a_image_link as $ik => $ilink) {
$ilink = $this->set_post_data($ilink, $attr, $postID);
$a_image_link[$ik] = $ilink;
}
$layer['layer_action']->image_link = $a_image_link;
}
}
$this->arrLayers[$key] = $layer;
}
for ($mi = 1; $mi <= 10; $mi++) {
//set params to the post data
$pa = $this->getParam('params_' . $mi, '');
$pa = $this->set_post_data($pa, $attr, $postID);
$this->setParam('params_' . $mi, $pa);
}
}