• Resolved TheTJ

    (@measuringflower)


    Hi. I have looked through the documentation and instructions and the forum. I am not the best with how all the code stuff works. I have Genesis with a child theme and I cannot figure out where to put the <?php the_subtitle(); ?> bit. I tried in the style, I tried in Genesis Theme Settings, I tried in the functions. Nope to all. I need to know exactly what code to copy and exactly where to paste it. I’m wanting it to appear as smaller text directly below the main title of each post and page. Help please!

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Ben Huson

    (@husobj)

    Hi,

    I don’t have a Genesis theme to hand, but you may be able to add something like the following to your theme’s functions.php file:

    function my_genesis_post_title_output( $output ) {
       if ( function_exists( 'get_the_subtitle' )  ) {
          $output .= get_the_subtitle( get_the_ID(), '<p class="subtitle">', '</p>, false );
       }
       return $output;
    }
    add_filter( 'genesis_post_title_output', 'my_genesis_post_title_output' );
    Thread Starter TheTJ

    (@measuringflower)

    Tried it and its says this:

    Your PHP code changes were rolled back due to an error on line 344 of file wp-content/themes/restored316-tasteful/functions.php. Please fix and try saving again.

    syntax error, unexpected ‘genesis_post_title_output’ (T_STRING), expecting ‘,’ or ‘)’

    So I tried changing comma to a ), but it did not like it still.

    Thread Starter TheTJ

    (@measuringflower)

    And I still can’t figure it out lol. Help please.

    I’m trying to figure it out, too.

    Thread Starter TheTJ

    (@measuringflower)

    Figured it out (with help from the Genesis group on FB)! The code should go as follows (needed a ‘ after the <p>):

    function my_genesis_post_title_output( $output ) {
    if ( function_exists( ‘get_the_subtitle’ ) ) {
    $output .= get_the_subtitle( get_the_ID(), ‘<p class=”subtitle”>’, ‘</p>’, false );
    }
    return $output;
    }
    add_filter( ‘genesis_post_title_output’, ‘my_genesis_post_title_output’ );

    • This reply was modified 6 years, 1 month ago by TheTJ.
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘I May Be Dense’ is closed to new replies.