コード例 #1
0
ファイル: taxonomy-somcat.php プロジェクト: TimurMG/mg-red
" title="<?php 
        the_title();
        ?>
"><?php 
        get_image_thumb(get_the_ID(), array(95, 70));
        ?>
</a></div>

                                    <?php 
    }
    ?>

                                    <div class="post_time">

                                        <?php 
    echo get_date_formatted(get_the_date('d.m.Y.H.i'));
    ?>

                                        <span class="views"><i class="views-ico"></i><?php 
    $views = get_post_meta(get_the_ID(), 'views', true);
    echo empty($views) ? '0' : $views;
    ?>
</span>

                                    </div>

                                    <h2 class="post_title"><a href="<?php 
    the_permalink();
    ?>
" title="<?php 
    the_title();
コード例 #2
0
ファイル: single-catalog.php プロジェクト: TimurMG/mg-red
    ?>
                                <div class="single-item catalog">
                                    <?php 
    $location = get_the_terms(get_the_ID(), 'nlocation');
    if ($location) {
        $location = array_shift($location);
        $location = $location->name;
    } else {
        $location = "Уральск";
    }
    ?>
                                    <div class="top">
                                        <div class="post_info">
                                            <span
                                                class="date"><?php 
    echo get_date_formatted(get_the_date('d.m.Y.H.i'), 'slide');
    ?>
</span>
                                            <span class="location"><?php 
    echo $location;
    ?>
</span>
                                        </div>
                                        <?php 
    if (has_post_thumbnail()) {
        $thumb_id = get_post_thumbnail_id(get_the_ID());
        $url = get_image_by_id($thumb_id, array(800, 600), true, true);
        echo "<a href='" . $url . "'>";
        get_image_thumb(get_the_ID(), array(165, 120));
        echo "</a>";
    }
コード例 #3
0
ファイル: functions.php プロジェクト: TimurMG/mg-red
function get_more_posts()
{
    $nonce = $_POST['nonce'];
    $qObjId = $_POST['term'];
    $tax = $_POST['tax'];
    $pType = $_POST['pType'];
    $offset = intval($_POST['offset']);
    $limit = intval($_POST['limit']);
    if (!wp_verify_nonce($nonce, 'ajax-nonce') || $offset == 0 || ($limit == 0 || $limit > 50) || is_array($offset)) {
        wp_die();
    }
    $types = get_post_types(array('public' => true), 'names');
    if (!in_array($pType, $types)) {
        wp_die();
    }
    $params = array('post_type' => $pType, 'posts_per_page' => $limit, 'offset' => $offset);
    $taxes = array('ncategory', 'ntag', 'adscategory', 'catcategory');
    if (!empty($tax) && in_array($tax, $taxes)) {
        if ($qObjId == 0 || is_array($qObjId)) {
            wp_die();
        }
        $params['tax_query'][] = array('taxonomy' => $tax, 'field' => 'id', 'terms' => $qObjId);
    }
    $posts = get_posts($params);
    $output = array();
    foreach ($posts as $post) {
        $row = array();
        $row['title'] = htmlspecialchars($post->post_title);
        $row['date'] = get_date_formatted(date_format(new DateTime($post->post_date), 'd.m.Y.H.i'));
        $row['link'] = get_permalink($post->ID);
        if ($post->post_type == 'news' || $post->post_type == 'ads') {
            $views = get_post_meta($post->ID, 'views', true);
            $row['views'] = empty($views) ? '0' : $views;
            if (has_post_thumbnail($post->ID)) {
                $img_url = wp_get_attachment_url(get_post_thumbnail_id($post->ID), 'full');
                $sizes = $post->post_type == 'news' ? array(60, 60) : array(96, 75);
                $row['src'] = aq_resize($img_url, $sizes[0], $sizes[1], true);
            } else {
                $row['src'] = $post->post_type == 'news' ? null : get_template_directory_uri() . '/images/blank_image.png';
            }
            if ($post->post_type == 'news') {
                $row['comments'] = get_comments_number($post->ID);
            }
            if ($post->post_type == 'ads') {
                $row['short'] = htmlspecialchars(kama_excerpt("maxchar=80&echo", $post));
            }
        }
        if ($post->post_type == 'catalog' || $post->post_type == 'ads') {
            $location = get_the_terms($post->ID, 'nlocation');
            if ($location) {
                $location = array_shift($location);
                $row['location'] = $location->name;
            } else {
                $row['location'] = "Уральск";
            }
            if ($post->post_type == 'catalog') {
                $contact = get_post_meta($post->ID, 'catalog_contacts', true);
                preg_match('#\\d+-\\d+-\\d+|\\d+ \\d+ \\d+|\\d+#ui', $contact, $phone_arr);
                $row['contact'] = count($phone_arr) > 0 ? $phone_arr[0] : ' - ';
            }
        }
        $output[] = $row;
    }
    exit(json_encode($output));
}
コード例 #4
0
ファイル: single-som.php プロジェクト: TimurMG/mg-red
get_header('soms');
?>

<div class="category-news-block auto rek" style="  background-image: none !important; float:right !important; width:670px; margin-top:0px !important;">

<?php 
while ( have_posts() ) : the_post(); //стандартная итерация по массиву 
?>

<div style="background-color:#EEE; padding:20px;">
<h1 style="font-family:bandera_proregular; font-size:50px; border-bottom:0 !important; margin-bottom:0 !important;">
<?php the_title(); ?> 
</h1>

<h1 style="font-family:Verdana, Geneva, sans-serif; border-bottom: 0 !important; font-size:25px; margin:0; padding:0;">
<span style="font-size:10px; color:#333;"><?php echo get_date_formatted(get_the_date('d.m.Y.H.i')); ?></span> <span style="font-size:10px; color:#333;">&nbsp;&nbsp;&nbsp; Коментариев: <?php comments_number('0', '1', '%'); ?> &nbsp;&nbsp;&nbsp; Просмотров: <?php setPostViews(get_the_ID()); ?><?php echo getPostViews(get_the_ID()); ?></span>
</h1>

</div>


<div style="overflow:hidden;" class="single-som">
<?php the_content(); ?>
</div>

<br>
<script type="text/javascript">(function() {
  if (window.pluso)if (typeof window.pluso.start == "function") return;
  if (window.ifpluso==undefined) { window.ifpluso = 1;
    var d = document, s = d.createElement('script'), g = 'getElementsByTagName';
    s.type = 'text/javascript'; s.charset='UTF-8'; s.async = true;