Beispiel #1
0
        }
        ?>
                    </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'];
Beispiel #2
0
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;
    }
}
Beispiel #3
0
if ($attachments->exist()) {
    ?>
	<div id="carousel" class="carousel slide carousel-fade" data-ride="carousel" data-interval="3500" data-pause="false">

		<div class="carousel-inner" role="listbox">
			<?php 
    while ($index = $attachments->get()) {
        ?>
			<div class="item<?php 
        if ($index->id == $attachments->id(0)) {
            ?>
 active<?php 
        }
        ?>
" data-title="<?php 
        echo sanitize_title($attachments->field('title'));
        ?>
" style="background-image:url(<?php 
        echo $attachments->src('full');
        ?>
);"></div>
			<?php 
    }
    ?>
		</div>
	
		<h1 id="keywords">
			<span id="ignite">Ignite.</span>
			<span id="align">Align.</span>
			<span id="mobilize">Mobilize.</span>
		</h1>
							<?php 
    while ($index = $attachments->get()) {
        ?>
								<div class="item<?php 
        if ($index->id == $attachments->id(0)) {
            ?>
 active<?php 
        }
        ?>
">
									<?php 
        echo $attachments->image('full');
        ?>
									<div class="carousel-caption">
										<?php 
        echo $attachments->field('caption');
        ?>
									</div>
								</div>
							<?php 
    }
    ?>
							</div>
						</div>
					</div>
				</div>
				<?php 
}
?>
				<div class="row">
					<div class="col-md-8 content">
Beispiel #5
0
/* pass the instance name */
?>
    <?php 
if ($attachments->exist()) {
    ?>
        <h2>Pièces jointes à télécharger</h2>
        <ul>
            <?php 
    while ($attachment = $attachments->get()) {
        ?>
                <li>
                    <a href="<?php 
        echo $attachments->url();
        ?>
"><?php 
        echo $attachments->field('title');
        ?>
</a>
                </li>
            <?php 
    }
    ?>
        </ul>
    <?php 
}
?>

    <?php 
if (comments_open() || get_comments_number()) {
    comments_template();
}
  <h3 class="page-header">Page attachments</h3>
  <div id="page-attachments">
    <?php 
    while ($attachments->get()) {
        ?>
      <div class="row-fluid">
		<div class="span1"><?php 
        echo $attachments->image('thumbnail');
        ?>
</div>
		<div class="span11">
			<a target="_blank" href="<?php 
        echo $attachments->url();
        ?>
" title="Download"><i class="icon-download-alt"></i> <?php 
        echo $attachments->field('title');
        ?>
 / <?php 
        echo $attachments->filesize();
        ?>
 (<?php 
        echo $attachments->subtype();
        ?>
)</a>
			<?php 
        if ($attachments->field('caption') != "") {
            ?>
				<p><?php 
            echo $attachments->field('caption');
            ?>
</p>			
Beispiel #7
0
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;
}