I am new to Wordpress and have the following problem:
I am working on a website that includes a blog page with news -> it is referred to by the navigation list item "NEWS".
In addition, I have created an additional custom post type with a listing of events. -> it is referred to by the navigation list item: "EVENTS". The page with the event list is based on the file page-events.php. When you click on a event to get a single view, the page that opens is based on single-event.php.
So basically I have two single.php-files, one for my news, the other one for my events.
MY PROBLEM: When you click on an event for a single view or you click on an event category and leave the file page-events.php, then in the navigation bar the "EVENTS" list item is no longer selected as the current page item, BUT the "NEWS" list item.
Well, the "NEWS" item refers to my main blog page. How can I achieve that the "EVENTS" list item stays selected when I click on an event in my event list?
Here the code of my single-event.php:
<!-- Header -->
<?php get_header();
if ( is_page() ) {
if($post->post_parent)
$children =
wp_list_pages("title_li=&child_of=".
$post->post_parent."&echo=0");
else
$children =
wp_list_pages("title_li=&child_of=".
$post->ID."&echo=0");
if ($children) {
echo "<div id='submenu'>";
echo "<ul>";
echo $children;
echo "</ul>";
echo "</div>";
}
} else {
if ( !function_exists('dynamic_sidebar') ||
dynamic_sidebar('Sidebar') ) :
endif; }
st_before_content($columns=''); ?>
<!-- Content -->
<?php if ( have_posts() ) :
while ( have_posts() ) : the_post();
$custom_fields = get_post_custom( $post->ID ); ?>
<h2><?php the_title(); ?></h2>
<? $date = get_the_term_list( $post->ID, 'date' ); ?>
<h3><?php echo $date; ?> • <?php echo
$custom_fields["time"][0]; ?> h</h3>
<?php
if ( function_exists('has_post_thumbnail') &&
has_post_thumbnail() ) {
the_post_thumbnail();
} ?>
<p><?php the_content(); ?></p>
<?php endwhile; endif; ?>
<!-- Footer -->
<?php
st_after_content();
get_footer();
?>