Exemplo n.º 1
0
 /**
  * Summary.
  *
  * @since    0.9.0
  * @see
  *
  * @param $post
  *
  * @return \stdClass
  * @internal param \WP_Post $postData
  * @author   nguyenvanduocit
  */
 public function populate($post)
 {
     $postData = parent::populate($post);
     $startDatetime = get_post_meta($post->ID, META_EVENT_DATETIME_START, true);
     $endDatetime = get_post_meta($post->ID, META_EVENT_DATETIME_END, true);
     /** @var \DateTime start_datetime */
     $postData->start_datetime = \DateTime::createFromFormat('Y-m-d H:i:s', $startDatetime);
     $postData->end_datetime = \DateTime::createFromFormat('Y-m-d H:i:s', $endDatetime);
     $placeId = get_post_meta($post->ID, META_EVENT_PLACE_ID, true);
     $postData->place = PostFactory()->populate($placeId);
     return $postData;
 }
Exemplo n.º 2
0
 public function registerPosttype()
 {
     $postFactory = PostFactory();
     foreach ($this->postTypeList as $postTypeClassPath) {
         if (class_exists($postTypeClassPath)) {
             /** @var PostType\Base $loadedClass */
             $loadedClass = new $postTypeClassPath();
             $loadedClass->registerPostType();
             $postFactory->add($loadedClass);
         }
     }
 }
Exemplo n.º 3
0
 public function register()
 {
     $postTypes = PostFactory()->getAll();
     register_taxonomy('location', array_keys($postTypes), array('hierarchical' => true, 'label' => 'Location', 'rewrite' => array('slug' => 'dia-chi')));
 }
<?php

$postType = PostFactory()->get('temple');
global $wp_query;
$args = array('post_type' => $postType->getPostType(), 'paged' => 1, 'posts_per_page' => 7, 'post_status' => array('publish'));
$wp_query = new WP_Query($args);
if (have_posts()) {
    ?>
	<section class="<?php 
    echo $postType->getPostType();
    ?>
 home-section">
		<div class="color-block section-color"></div>
		<div class="container">
			<?php 
    the_post();
    ?>
			<div class="row lead-row">
				<div class="section-title-container">
					<div class="section-title-text">
						<h1 class="section-title" id="events">Chùa</h1>
						<p class="section-subtitle">Danh bạ các Chùa Phật Giáo</p>
					</div>
					<img src="<?php 
    _e($postType->getThumbnail());
    ?>
" alt="Events Calendar Icon" class="section-icon">
				</div>
				<?php 
    get_template_part('template/content-lead', $postType->getPostType());
    ?>
<?php

global $wp_query;
$event = PostFactory()->populate($post);
?>
<article class="article-4 event <?php 
if (($wp_query->current_post + 1) % 4 !== 0) {
    echo 'nrm';
} else {
    echo 'nrm-d';
}
?>
">
	<div class="image-container" style="background-image: url('<?php 
_e($event->thumbnailURL);
?>
');">
		<p class="date"><?php 
_e($event->start_datetime->format('d'));
?>
 - <?php 
_e($event->end_datetime->format('d'));
?>
</p>
		<p class="month"><?php 
_e($event->start_datetime->format('d/m'));
?>
 - <?php 
_e($event->end_datetime->format('d/m'));
?>
</p>
Exemplo n.º 6
0
<?php

global $wp_query;
$postData = PostFactory()->populate($post);
?>
<article class="article-4 event <?php 
if (($wp_query->current_post + 1) % 4 !== 0) {
    echo 'nrm';
} else {
    echo 'nrm-d';
}
?>
">
	<div class="image-container" style="background-image: url('<?php 
_e($postData->thumbnailURL);
?>
');"></div>
	<div class="article-content">
		<h3 class="article-heading text-color"><?php 
_e($postData->title);
?>
</h3>
		<p class="article-description">Mexico City, Mexico</p>
		<a href="<?php 
_e(get_permalink());
?>
" class="article-link text-color">XEM THÊM</a>
	</div>
</article>
<?php

global $wp_query;
$temple = PostFactory()->populate($post);
?>
<article class="article-4 event <?php 
if (($wp_query->current_post + 1) % 4 !== 0) {
    echo 'nrm';
} else {
    echo 'nrm-d';
}
?>
">
	<div class="image-container" style="background-image: url('<?php 
_e($temple->thumbnailURL);
?>
');"></div>
	<div class="article-content">
		<h3 class="article-heading text-color"><?php 
_e($temple->title);
?>
</h3>
		<div class="article-description">
			<div class="location"><?php 
echo TemplateTag()->formatLocation($temple->location);
?>
			</div>
		</div>
		<a href="<?php 
_e(get_permalink());
?>
<?php

$postType = PostFactory()->get('event');
global $wp_query;
$args = array('post_type' => $postType->getPostType(), 'paged' => 1, 'posts_per_page' => 7, 'post_status' => array('publish'));
$wp_query = new WP_Query($args);
if (have_posts()) {
    ?>
	<section class="<?php 
    echo $postType->getPostType();
    ?>
 home-section">
		<div class="color-block section-color"></div>
		<div class="container">
			<?php 
    the_post();
    ?>
			<div class="row lead-row">
				<div class="section-title-container">
					<div class="section-title-text">
						<h1 class="section-title" id="temple">Sự kiện</h1>
						<p class="section-subtitle">ấdfasdf</p>
					</div>
					<img src="<?php 
    _e($postType->getThumbnail());
    ?>
" alt="Events Calendar Icon" class="section-icon">
				</div>
				<?php 
    get_template_part('template/content-lead', $postType->getPostType());
    ?>