本文整理汇总了PHP中Attachments::url方法的典型用法代码示例。如果您正苦于以下问题:PHP Attachments::url方法的具体用法?PHP Attachments::url怎么用?PHP Attachments::url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Attachments
的用法示例。
在下文中一共展示了Attachments::url方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_banner
function get_banner($banner_slug, $echo = true, $url_and_link = false)
{
$banner_id = get_post_id_by_slug($banner_slug, 'banners');
$banners = new Attachments('banner_attachments', $banner_id);
$output = "";
if ($banners->exist()) {
$i = 0;
//пишем всю эту муть.. там в Attachments::()->OneSort();
$o = $banners->OneSort();
if (empty($o)) {
$o = 0;
}
//ты втираешь мне какуюто Дичь!?
if ($banners->total() > 1) {
if (!session_id()) {
session_start();
}
if (!isset($_SESSION[$banner_slug])) {
$_SESSION[$banner_slug] = $o;
$_SESSION[start] = true;
} else {
$_SESSION[start] = false;
}
$i = intval($_SESSION[$banner_slug]);
//извольте?!?
if ($_SESSION[start]) {
$i = $i;
} else {
if ($i < $banners->total() - 1) {
$_SESSION[$banner_slug] = ++$i;
} else {
$_SESSION[$banner_slug] = $i = 0;
}
}
}
if ($banners->get_single($i)) {
if ($url_and_link) {
return array('url' => $banners->url($i), 'link' => $banners->field('link_url', $i));
}
if ($banners->type($i) == 'image') {
$b_url = $banners->field('link_url', $i);
if (!empty($b_url)) {
$output .= '<noindex><a rel="nofollow" href="' . $b_url . '" target="_blank">';
}
$output .= '<img src="' . $banners->url($i) . '" width="100%" />';
if (!empty($b_url)) {
$output .= '</a></noindex>';
}
}
if ($banners->type($i) == 'application') {
$hb = explode("x", $banner_slug);
$parent_id = $banner_slug . '_' . $banners->id($i);
$output .= '<div id="' . $parent_id . '"><script type="text/javascript">';
$output .= 'swfobject.embedSWF("' . $banners->url($i) . '", "' . $parent_id . '", "100%", "' . $hb[1] . '", "10.0.0", "install flash player", null, {menu: "false", wmode: "transparent", scale:"default"}, null);';
$output .= '</script></div>';
}
}
} else {
if ($echo) {
echo $output;
} else {
return false;
}
}
if ($echo) {
echo $output;
} else {
return $output;
}
}
示例2: Attachments
</span>
<!-- <span class="main-content__item__foot"></span>-->
</a>
<?php
// retrieve all Attachments for the 'attachments' instance of post 123
$attachments = new Attachments('attachments', get_the_ID());
?>
<?php
if ($attachments->exist()) {
?>
<?php
while ($attachments->get()) {
?>
<input type="hidden" value="<?php
echo $attachments->url();
?>
" class="hidden-<?php
echo get_the_ID();
?>
">
<?php
}
?>
<?php
}
?>
</div>
<?php
}
}
示例3: Attachments
}
?>
</div>
<!-- <h3>--><?php
//the_title();
?>
<!--</h3>-->
</div>
<?php
// retrieve all Attachments for the 'attachments' instance of post 123
$attachments = new Attachments('attachments', get_the_ID());
$data = $attachments->get_attachments();
if (!empty($data)) {
$data = [];
while ($attachments->get()) {
$data[] = array('url' => $attachments->url(), 'title' => $attachments->field('title'), 'caption' => $attachments->field('caption'));
}
}
?>
<div class="page__body page__scrolltext">
<div class="col-xs-3">
<?php
if (!empty($data)) {
foreach ($data as $item) {
?>
<a class="author__photo--item" href="<?php
echo $item['url'];
?>
"
data-lightbox="example-set" data-title="<?php
echo $item['caption'];
示例4: Attachments
$attachments = new Attachments('netevl_attachments_' . $thisPostType);
?>
<div class="cpts-table-box list-item">
<div class="col">
<h3 class="title"><?php
the_title();
?>
</h3>
<?php
if ($attachments->exist()) {
$index = 0;
while ($attachment = $attachments->get()) {
//$is_right = $themeMethods->checkUserRoles();
$is_right = true;
$cssClass = $index == 0 ? ' is-current' : ' is-old';
echo sprintf('<a href="%s" class="attr%s" target="_blank">%s</a>', $is_right ? $attachments->url() : '#', $is_right ? $cssClass : '', $attachment->fields->file_title);
$index++;
}
}
?>
</div>
<div class="col col-author">
Autor: <strong>Oswald</strong>
</div>
</div>
<!--<a href="#" class="show-list">Zobrazit vše</a>-->
<?php
}
?>
示例5: printElement
function printElement($post)
{
$attachments = new Attachments('gallery_attachments', $post->ID);
$path_img = esc_url(get_template_directory_uri()) . '/images/';
if ($attachments->exist()) {
//VIDEO INTERNO
//echo '<div class="swiper-slide video-player-interno">';
echo '<video class="cover-video" autoplay muted loop>';
while ($attachments->get()) {
$extension = explode('.', $attachments->url());
$ext = $extension[count($extension) - 1];
echo '<source src="' . $attachments->url() . '" type="video/' . $ext . '">';
}
echo '</video>';
//echo '<div class="slide-description"><img src="'.$path_img.'video_play_black.png" /><h1 class="hidden-xs hidden-sm">'.$post->post_title.'</h1><p class="hidden-xs hidden-sm">'.$post->post_content.'</p></div>';
//echo '</div>';
} else {
if (wp_get_attachment_url(get_post_thumbnail_id($post->ID)) != false) {
//è un'immagine
echo '<div class="swiper-slide">';
echo '<div class="swiper-slide-image" style="background:url(\'' . wp_get_attachment_url(get_post_thumbnail_id($post->ID)) . '\') center center" />';
echo '<div class="slide-description hidden-xs hidden-sm"><h1>' . $post->post_title . '</h1><p>' . $post->post_content . '</p></div>';
echo '</div>';
echo '</div>';
} else {
//è un video di youtube
//$embed_video = str_replace('watch?v=', 'embed/', get_post_meta($post->ID, 'video', true));
$embed_video = explode('watch?v=', get_post_meta($post->ID, 'video', true));
$idVideo = $embed_video[count($embed_video) - 1];
?>
<div id="video"></div>
<script>
$('#video').YTPlayer({
fitToBackground: true,
videoId: '<?php
echo $idVideo;
?>
'
});
</script>
<?php
}
}
}
示例6: Attachments
<?php
$thisPostType = get_post_type();
$attachments = new Attachments('netevl_attachments_' . $thisPostType);
$fileCz = null;
$fileEn = null;
if ($attachments->exist()) {
while ($attachment = $attachments->get()) {
if ($attachment->fields->file_lang == 'cz') {
$fileCz = $attachments->url();
}
if ($attachment->fields->file_lang == 'en') {
$fileEn = $attachments->url();
}
}
}
$schvaleno = get_post_meta(get_the_ID(), '_netevl_' . $thisPostType . '_schvaleno', true);
?>
<div class="page-header">
<h1><?php
the_title();
?>
</h1>
<ul class="info-bar">
<?php
if (strlen($schvaleno) > 0) {
?>
<li class="info-released"><strong><?php
echo $schvaleno;
?>
示例7: get_attachments_array
function get_attachments_array($name, $srcSize = 'full')
{
$return = array();
$attachments = new Attachments($name);
if ($attachments->exist()) {
$i = 0;
while ($attachments->get()) {
$return[$i]['id'] = $attachments->id();
$return[$i]['type'] = $attachments->type();
$return[$i]['subtype'] = $attachments->subtype();
$return[$i]['url'] = $attachments->url();
$return[$i]['thumbnail'] = $attachments->image('thumbnail');
$return[$i]['srcfull'] = $attachments->src('full');
$return[$i]['src'] = $attachments->src($srcSize);
$return[$i]['filesize'] = $attachments->filesize();
$return[$i]['title'] = $attachments->field('title');
$return[$i]['caption'] = $attachments->field('caption');
$i++;
}
}
return $return;
}
示例8: getSection
function getSection($sectionName, $posts, $thisPostType)
{
$rtn = '<section class="section">';
$rtn .= '<h2 class="section-title">' . $sectionName . '</h2>';
$rtn .= '<table class="cpts-table">';
$rtn .= '<thead>';
$rtn .= '<tr>';
$rtn .= '<th class="col-number">Číslo</th>';
$rtn .= '<th class="col-name">Název</th>';
$rtn .= '<th class="col-date">Schváleno</th>';
$rtn .= '<th class="col-download">Česky</th>';
$rtn .= '<th class="col-download">Anglicky</th>';
$rtn .= '</tr>';
$rtn .= '</thead>';
$rtn .= '<tbody>';
while ($posts->have_posts()) {
$posts->the_post();
$attachments = new Attachments('netevl_attachments_' . $thisPostType);
$fileCz = null;
$fileEn = null;
if ($attachments->exist()) {
while ($attachment = $attachments->get()) {
if ($attachment->fields->file_lang == 'cz') {
$fileCz = $attachments->url();
}
if ($attachment->fields->file_lang == 'en') {
$fileEn = $attachments->url();
}
}
}
$rtn .= '<tr>';
$rtn .= '<td class="col-number">' . get_post_meta(get_the_ID(), '_netevl_' . $thisPostType . '_cislo', true) . '</td>';
$rtn .= '<td class="col-name"><h3 class="title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h3></td>';
$rtn .= '<td class="col-date">' . get_post_meta(get_the_ID(), '_netevl_' . $thisPostType . '_schvaleno', true) . '</td>';
$rtn .= '<td class="col-download">';
if (!is_null($fileCz)) {
$rtn .= '<a href="' . $fileCz . '" class="picto-pdf" target="_blank"></a>';
}
$rtn .= '</td>';
$rtn .= '<td class="col-download">';
if (!is_null($fileEn)) {
$rtn .= '<a href="' . $fileEn . '" class="picto-pdf" target="_blank"></a>';
}
$rtn .= '</td>';
$rtn .= '</tr>';
}
$rtn .= '</tbody>';
$rtn .= '</table>';
$rtn .= '</section>';
echo $rtn;
}