Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1388977

    DerekbyDesign
    Participant

    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>

    #1389100

    Darshana
    Moderator

    Hi 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.

    #1395998

    DerekbyDesign
    Participant

    Hi 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.

    #1396030

    Christopher
    Moderator

    Hi 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.

    #1396156

    DerekbyDesign
    Participant

    Thank you so much for that!

    #1396182

    Christopher
    Moderator

    You’re welcome.