Do not display subtitles on pages!
-
Sorry Philip,
unfortunately I have not found a small error and can not find the solution. It would be nice if you could help me again. Look times here: https://magazin.bloggernotizen.de/impressum.html … On the side of Subtitle will not be displayed, despite that I have applied it in the Admin. Where could the problem be and how can I fix it ???
Greeting Michael Erich Pilarczyk
-
Hi Michael,
Subtitles will be automatically displayed when titles are used inside of the Loop. I have explained that here.
What do you mean “On the side of…” Where is the subtitle supposed to be displayed. Can you post the code of the page.php file that you’re using with your theme.
I can assure you that these issues are theme issues, not a Subtitles issue, but I will be happy to assist and help you identify what may be causing this problem.
Thanks.
Hi,
here the code of my page.php:
<?php get_header(); ?> <section class="content"> <?php get_template_part('inc/page-title'); ?> <div class="pad group"> <?php while ( have_posts() ): the_post(); ?> <article <?php post_class('group'); ?>> <?php get_template_part('inc/page-image'); ?> <div class="entry themeform"> <?php the_content(); ?> <div class="clear"></div> </div><!--/.entry--> </article> <?php if ( ot_get_option('page-comments') == 'on' ) { comments_template('/comments.php',true); } ?> <?php endwhile; ?> </div><!--/.pad--> </section><!--/.content--> <?php get_sidebar(); ?> <?php get_footer(); ?>
Is it okay?!?
Greeting Michael Erich Pilarczyk
P.S. Sorry, “On the side of” is my bad English… :-(:-(
Your page title isn’t inside the Loop; that’s why Subtitles aren’t displaying. Please post your code from inc/page-title.php. Thanks.
Here the code of page-title.php:
<div class="page-title pad group"> <?php if ( is_home() ) : ?> <h2><?php echo alx_blog_title(); ?></h2> <?php elseif ( is_single() ): ?> <ul class="meta-single group"> <li class="category"><?php the_category(' <span>/</span> '); ?></li> <?php if ( comments_open() && ( ot_get_option( 'comment-count' ) != 'off' ) ): ?> <li class="comments"><a href="<?php comments_link(); ?>"><i class="fa fa-comments-o"></i><?php comments_number( '0', '1', '%' ); ?></a></li> <?php endif; ?> </ul> <?php elseif ( is_page() ): ?> <h2><?php echo alx_page_title(); ?></h2> <?php elseif ( is_search() ): ?> <h1> <?php if ( have_posts() ): ?><i class="fa fa-search"></i><?php endif; ?> <?php if ( !have_posts() ): ?><i class="fa fa-exclamation-circle"></i><?php endif; ?> <?php $search_count = 0; $search = new WP_Query("s=$s & showposts=-1"); if($search->have_posts()) : while($search->have_posts()) : $search->the_post(); $search_count++; endwhile; endif; echo $search_count;?> <?php _e('Search results','hueman'); ?></h1> <?php elseif ( is_404() ): ?> <h1><i class="fa fa-exclamation-circle"></i><?php _e('Error 404.','hueman'); ?> <span><?php _e('Page not found!','hueman'); ?></span></h1> <?php elseif ( is_author() ): ?> <?php $author = get_userdata( get_query_var('author') );?> <h1><i class="fa fa-user"></i><?php _e('Author:','hueman'); ?> <span><?php echo $author->display_name;?></span></h1> <?php elseif ( is_category() ): ?> <h1><i class="fa fa-folder-open"></i><?php _e('Category:','hueman'); ?> <span><?php echo single_cat_title('', false); ?></span></h1> <?php elseif ( is_tag() ): ?> <h1><i class="fa fa-tags"></i><?php _e('Tagged:','hueman'); ?> <span><?php echo single_tag_title('', false); ?></span></h1> <?php elseif ( is_day() ): ?> <h1><i class="fa fa-calendar"></i><?php _e('Daily Archive:','hueman'); ?> <span><?php echo get_the_time('F j, Y'); ?></span></h1> <?php elseif ( is_month() ): ?> <h1><i class="fa fa-calendar"></i><?php _e('Monthly Archive:','hueman'); ?> <span><?php echo get_the_time('F Y'); ?></span></h1> <?php elseif ( is_year() ): ?> <h1><i class="fa fa-calendar"></i><?php _e('Yearly Archive:','hueman'); ?> <span><?php echo get_the_time('Y'); ?></span></h1> <?php else: ?> <h2><?php the_title(); ?></h2> <?php endif; ?> </div><!--/.page-title-->
Okay!?!
Wow. That’s…. a lot.
The only way to fix this in your theme would be to delete this:
<?php elseif ( is_page() ): ?> <h2><?php echo alx_page_title(); ?></h2>
And then in page.php put this inside of your Loop:
<h2><?php echo alx_page_title(); ?></h2>
Philip,
now I’m a little overwhelmed! “In my Lopp”? At what point should I paste the page.php?
In the Loop. What I mean is that it needs to come after this part:
<?php while ( have_posts() ): the_post(); ?>
So maybe something like this:
<?php get_header(); ?> <section class="content"> <div class="pad group"> <?php while ( have_posts() ): the_post(); ?> <h2><?php echo alx_page_title(); ?></h2> <article <?php post_class('group'); ?>> <?php get_template_part('inc/page-image'); ?> <div class="entry themeform"> <?php the_content(); ?> <div class="clear"></div> </div><!--/.entry--> </article> <?php if ( ot_get_option('page-comments') == 'on' ) { comments_template('/comments.php',true); } ?> <?php endwhile; ?> </div><!--/.pad--> </section><!--/.content--> <?php get_sidebar(); ?> <?php get_footer(); ?>
Okay look here https://magazin.bloggernotizen.de/impressum.html … It works for some time now. The subtitle is now totally put in the wrong. Title of the page is “Impressum” over the line and the subtitle is “Auch Pages erhalten einen SubTitle.”.
Try this:
<?php get_header(); ?> <section class="content"> <?php get_template_part( 'inc/page-title' ); if ( function_exists( 'the_subtitle' ) ) { the_subtitle( '<p class="entry-subtitle">', '</p>' ); } ?> <div class="pad group"> <?php while ( have_posts() ): the_post(); ?> <article <?php post_class( 'group' ); ?>> <?php get_template_part( 'inc/page-image' ); ?> <div class="entry themeform"> <?php the_content(); ?> <div class="clear"></div> </div><!--/.entry--> </article> <?php if ( 'on' == ot_get_option( 'page-comments' ) ) { comments_template( '/comments.php',true ); } ?> <?php endwhile; ?> </div><!--/.pad--> </section><!--/.content--> <?php get_sidebar(); ?> <?php get_footer(); ?>
Sorry that I love you so intensely bother with this crap! Argh, please look again to the side. It is better, but unfortunately still fits. The Subtitle has slipped and still under the line!
Do you have a caching plugin active? I cannot see the subtitle on your site right now. Please tell me the Title and Subtitle text that you expect to see on the site. Thanks.
Oh sorry, my mistake. I have emptied and replaced the cache. The title is “Impressum” and the Subtitle is “Auch Pages erhalten einen SubTitle.”. The css class will not be accepted. In posts yet it goes.
So you want the subtitle to be directly under the title? Open page-title.php and change this:
<?php elseif ( is_page() ): ?> <h2><?php echo alx_page_title(); ?></h2>
To this:
<?php elseif ( is_page() ): ?> <h2> <?php echo alx_page_title(); ?> <?php if ( function_exists( 'the_subtitle' ) ) { the_subtitle(); } ?> </h2>
Cheers!
Yes the subtitle should appear directly below the title and above the line.
The code
<?php elseif ( is_page() ): ?> <h2><?php echo alx_page_title(); ?></h2>
I have not in my page-title.php. See above the code!?!
- The topic ‘Do not display subtitles on pages!’ is closed to new replies.