예제 #1
0
                    <ul class="single-competition-content">
                        <?php 
    $list = "";
    $attaches = get_posts(array('post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => get_the_ID()));
    foreach ($attaches as $k => $v) {
        $likes = get_post_meta($v->ID, 'competition_like', true);
        $likes = $likes ? $likes : 0;
        $attaches[$k]->likes = $likes;
    }
    uasort($attaches, "sort_objects_by_likes");
    foreach ($attaches as $attach) {
        $type = get_post_mime_type($attach->ID);
        if (strpos($type, 'image') !== false) {
            $url = get_image_by_id($attach->ID, array(194, 194), true, true);
            $full_path = get_image_by_id($attach->ID, array(800, 600), true, true);
            $ips = get_post_meta($attach->ID, 'competition_ips', true);
            $ips = $ips ? json_decode($ips) : array();
            $disabled = in_array(get_user_ip(), $ips);
            $list .= '<li>';
            $list .= '<a href="' . $full_path . '">';
            $list .= '<img src="' . $url . '" alt="' . $attach->post_title . '" width="194" height="194" /></a>';
            if ($disabled) {
                $list .= '<div class="likes disabled"><i class="like-ico"></i><span class="count">' . $attach->likes . '</span></div>';
            } else {
                $list .= '<div class="likes"><a href="#like-' . $attach->ID . '"><i class="like-ico"></i></a><span class="count">' . $attach->likes . '</span></div>';
            }
            $list .= '</li>';
        }
    }
    echo $list;
예제 #2
0
if (get_option('show_case') == 'checked') {
    ?>
<div class=" show-case">
  <div class="block-title"><h2><a href="/show-case">案例展示</a></h2></div>
  <div class="row three-image-block">
  <?php 
    $args_case = array('post_type' => get_option('case_type'), 'posts_per_page' => get_option('case_num'));
    $query_case = new WP_Query($args_case);
    if ($query_case->have_posts()) {
        while ($query_case->have_posts()) {
            $query_case->the_post();
            $data = array();
            $image_link = '';
            if (function_exists('get_field')) {
                $image_link = get_image_by_id(get_field('pic'));
            } else {
                $image_link = get_feature_image_by_id(get_the_ID());
            }
            $data = array('title' => get_the_title(), 'excertp' => get_the_excerpt(), 'link' => get_permalink(), 'image' => $image_link);
            ?>
        <div class="col-sm-4 item">
          <?php 
            include locate_template('module/case-block.php');
            ?>
        </div>
        <?php 
        }
    }
    wp_reset_postdata();
    ?>
예제 #3
0
function get_image_thumb($post_id = null, $sizes = array(224, 160), $crop = true, $url = false, $cl = "")
{
    $post_id = null === $post_id ? get_the_ID() : $post_id;
    $post_thumbnail_id = get_post_thumbnail_id($post_id);
    echo get_image_by_id($post_thumbnail_id, $sizes, $crop, $url, $cl);
}
예제 #4
0
<?php

include '../includes/backend/mysqli_connect.php';
include '../includes/functions.php';
if ($iid = validate_id($_GET['iid'])) {
    $set = get_image_by_id($iid);
    $images = array();
    if (mysqli_num_rows($set) > 0) {
        $images = mysqli_fetch_array($set, MYSQLI_ASSOC);
    } else {
        redirect_to('admin/list_images.php');
    }
} else {
    redirect_to('admin/list_images.php');
}
$title_page = $images['type_name'];
include '../includes/backend/header-admin.php';
?>

	<div class="content-wrapper">
        <div class="container">
            <div class="row">
                <div class="col-md-11" style="margin-left: 4.2%">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h2 style="text-align: center"><?php 
echo $images['type_name'];
?>
</h2>
                            <h4 style="text-align: center" ><a href="index.php"><?php 
echo $lang['ADD_IMAGE_LINK_HOME'];
         * echo $userinfo['email'];
         *
         * array_push($user_list, array("id"=>$userinfo['user_id'], "alias"=>$userinfo['user_alias'], "email"=>$userinfo['email']));
         * } else {
         * echo 'fail to get user list';
         *
         * }
         * }
         */
        $mysqli->close();
    }
    return $image_list;
}
$possible_url = array("get_image", "get_all_images");
$value = "An error has occurred";
if (isset($_POST["action"]) && in_array($_POST["action"], $possible_url)) {
    switch ($_POST["action"]) {
        case "get_all_images":
            $value = get_image_list();
            break;
        case "get_image":
            if (isset($_POST["id"])) {
                $value = get_image_by_id($_POST["id"]);
            } else {
                $value = "Missing argument";
            }
            break;
    }
}
// return JSON array
exit(json_encode($value));
예제 #6
0
  <h1 class="page-title">案例展示</h1>
  <div class="taxonomy-description">我们提供专业的wordpress定制服务,包括企业站已经商城<br/>所有网站均为响应式网站,支持多种主流手机平板设备</div>
</header><!-- .page-header -->
<div class="container">

  <div id="primary" class="content-area col-sm-12">
    <main id="main" class="site-main" role="main">

    <?php 
$args_case = array('post_type' => get_option('case_type'), 'posts_per_page' => 20);
$wp_query = new WP_Query($args_case);
if ($wp_query->have_posts()) {
    while ($wp_query->have_posts()) {
        $wp_query->the_post();
        $data = array();
        $data = array('title' => get_the_title(), 'excertp' => get_the_excerpt(), 'link' => get_permalink(), 'image' => get_image_by_id(get_field('pic')));
        ?>
      <div class="col-sm-4 item">
        <?php 
        include locate_template('module/case-block.php');
        ?>
      </div>
      <?php 
    }
    include locate_template('module/pagination.php');
} else {
    ?>

      <?php 
    get_template_part('template-parts/content', 'none');
    ?>
?>
" >Offers</a></li>
                  <li class="#"><a href="resturant_map.php?id=<?php 
echo $id;
?>
" >Location</a></li>
                  <li class="#"><a href="resturant_rating.php?id=<?php 
echo $id;
?>
" >Ratings</a></li>
                </ul>

                   
                   <?php 
$image = array();
$iresult = get_image_by_id($id);
while ($myrow = mysql_fetch_array($iresult)) {
    array_push($image, $myrow['image']);
}
?>
       

                  

                 <div class="ui huge images">
                   <img src="images/<?php 
echo $image[$photo_id];
?>
" style="margin-left: auto;
                   margin-right: auto ;  display: block; "  height="500" width="145">
                 </div>
예제 #8
0
                                        <div class="adc-content"><?php 
    the_content();
    ?>
</div>
                                    </div>
                                    <?php 
    $attachments = get_children(array('post_parent' => get_the_ID(), 'post_type' => 'attachment', 'post_mime_type' => 'image'));
    if (count($attachments) > 1) {
        ?>
                                        <div class="images">
                                            <?php 
        $thumb_id = isset($thumb_id) ? $thumb_id : get_post_thumbnail_id(get_the_ID());
        foreach ($attachments as $attach_id => $attach) {
            if ($thumb_id != $attach_id) {
                $image = get_image_by_id($attach_id, array(55, 40));
                $full_src = get_image_by_id($attach_id, array(800, 600), true, true);
                echo '<a href="' . $full_src . '">' . $image . '</a>';
            }
        }
        ?>
                                        </div>
                                    <?php 
    }
    ?>

                                    <div class="info">
                                        <div><span><strong>Цена: </strong> <?php 
    $price = get_post_meta(get_the_ID(), 'ads_price', true);
    echo empty($price) ? "-" : $price;
    ?>
</span></div>