Answer the question
In order to leave comments, you need to log in
How to display custom post type?
Greetings. Created a custom post type - "tour".
In sidebar.php, I only made the display of the titles of these posts. Everything is working. Here is what the title output looks like:
<a href="<?php the_permalink() ?>"> <?php echo $title[0]; ?> </a>
If anything, $title[0] contains custom meta field data. This part works great. <?php
get_header();
?>
<div class="container under_head">
<div class="row">
<div class="col-md-8">
<?php
if ( have_posts() )
{
while (have_posts())
{
the_post(); ?>
<div class="content">
<h3>
<?php the_title(); ?>
</h3>
<?php
$date = get_post_meta( get_the_ID(), 'tour_date' );
?>
<strong>Дата: </strong><?php echo $date[0] ?>
</div>
<?php
}
}
?>
<hr class="separator hidden-lg hidden-md">
</div>
<div class="col-md-4">
<div class="sidebar">
<?php get_sidebar(); ?>
</div>
</div>
</div>
</div>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question