Tagged: x
-
AuthorPosts
-
February 28, 2017 at 10:45 am #1388977
Hi there,
I want to add a subtitle to my posts, i am using the integrity stack. I found the following code
on this forum and want to make sure if this would work for my blog posts? Here it is and thankyou!:<?php
// =============================================================================
// VIEWS/INTEGRITY/_CONTENT-POST-HEADER.PHP
// —————————————————————————–
// Standard <header> output for various posts.
// =============================================================================?>
<header class=”entry-header”>
<?php if ( is_single() ) : ?>
<h1 class=”entry-title”><?php the_title(); ?></h1>
<?php else : ?>
<h2 class=”entry-title”>
” title=”<?php echo esc_attr( sprintf( __( ‘Permalink to: “%s”‘, ‘__x__’ ), the_title_attribute( ‘echo=0’ ) ) ); ?>”><?php x_the_alternate_title(); ?>
</h2>
<h3 class=”entry-subtitle”><?php
$subtitles = get_post_custom_values(‘subtitle’);
if ($subtitles != NULL) {
foreach($subtitles as $key => $value){
echo $value;
}
}
?>
</h3>
<?php endif; ?>
<?php x_integrity_entry_meta(); ?>
</header>February 28, 2017 at 12:15 pm #1389100Hi there,
Thanks for writing in! Please follow this example (https://community.theme.co/forums/topic/post-subtitles/#post-823061).
The only change is to copy the correct file from your selected stack. That is, _content-post-header.php from \wp-content\themes\x\framework\views\integrity to your child theme’s respective location \wp-content\themes\x-child\framework\views\integrity.
Hope that helps.
March 6, 2017 at 4:47 am #1395998Hi thankyou for the reply,
I notice on the attached link, the person needed help with the ethos stack, i am currently running on the integrity stack. What code should I use to get my subtitles running? I found this code above on a thread but have no idea if it would work. I have copied something like this before from a thread and it crashed my site. I already have a child theme running.
In the linked thread it says “Then copy the file _content-post-header.php from \wp-content\themes\x\framework\views\ethos to \wp-content\themes\x-child\framework\views\ethos. Then replace the entire code of the copied file to this:”
Then they supply the code for the ethos theme :
<?php
// =============================================================================
// VIEWS/ETHOS/_CONTENT-POST-HEADER.PHP
// —————————————————————————–
// Standard <header> output for various posts.
// =============================================================================?>
<header class=”entry-header”>
<?php if ( is_single() ) : ?>
<?php x_entry_navigation(); ?>
<h1 class=”entry-title”><?php the_title(); ?></h1><?php else : ?>
<h2 class=”entry-title”>
” title=”<?php echo esc_attr( sprintf( __( ‘Permalink to: “%s”‘, ‘__x__’ ), the_title_attribute( ‘echo=0’ ) ) ); ?>”><?php x_the_alternate_title(); ?>
</h2>
<?php endif; ?>
<h3 class=”entry-subtitle”><?php
$subtitles = get_post_custom_values(‘subtitle’);
if ($subtitles != NULL) {
foreach($subtitles as $key => $value){
echo $value;
}
}
?>
</h3><?php x_ethos_entry_meta(); ?>
</header>How should the code for the integrity stack look like, thank you so much.
March 6, 2017 at 5:17 am #1396030Hi there,
Please opy _content-post-header.php from framework/views/integrity and put it in the same path inside child theme, replace existing code with following :
<?php // ============================================================================= // VIEWS/INTEGRITY/_CONTENT-POST-HEADER.PHP // ----------------------------------------------------------------------------- // Standard <header> output for various posts. // ============================================================================= ?> <header class="entry-header"> <?php if ( is_single() ) : ?> <h1 class="entry-title"><?php the_title(); ?></h1> <?php else : ?> <h2 class="entry-title"> <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to: "%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ); ?>"><?php x_the_alternate_title(); ?></a> </h2> <?php endif; ?> <h3 class="entry-subtitle"><?php $subtitles = get_post_custom_values('subtitle'); if ($subtitles != NULL) { foreach($subtitles as $key => $value){ echo $value; } } ?> </h3> <?php x_integrity_entry_meta(); ?> </header>
Hope it helps.
March 6, 2017 at 7:02 am #1396156Thank you so much for that!
March 6, 2017 at 7:15 am #1396182You’re welcome.
-
AuthorPosts