Tagged: ,

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #972457

    Hi all. I thought someone else might find this useful at some point so I’m posting these instructions. I have a client who wants subtitles on many of their pages like this:

    After rooting around in the Enfold source code I found that the functions for displaying the title includes functionality for adding a subtitle but it looks like it’s not quite implemented. Based on Enfold’s code, it looks like the subtitle would be stored in post meta data but there’s no functionality to add a metabox for entering the data and so the code to grab the metadata is commented out.

    So after a little more searching, I found that the arguments for the title function can be filtered and added the following function to functions.php

    add_filter( 'avf_title_args' ,'pwm_title_args', 2,10);
    function pwm_title_args( $args, $id ){
    	if( $id && is_page( $id ) ):
    		$args['subtitle'] = get_post_meta( $id, 'subtitle', true );
    	endif;
    	return $args;
    }

    This function could be modified to handle any kind of post type or archive but I wouldn’t recommend it on standard posts. Since the header for individual posts displays the title “Blog – Latest News” a post-specific subtitle may not make sense unless the title was changed to something post-specific, too.

    At any rate, next, I edited a page in the backend, clicked Screen Options in the upper right corner to expand it and checked the “Custom Fields” checkbox. Then, I scrolled down to the Custom Fields metabox clicked Enter New (near the bottom) and created metadata named “subtitle” with the value “This is the subtitle”.

    When I browsed the page on the front end, I saw this:

    Obviously, it still has to be styled but it’s pretty close to what I’m looking for. I hope this article is useful to someone else. If you use this, please leave a comment about it. Thanks!

    #972475

    Hey Kevin!

    I guess you found a solution because the title is tagged as solved :)

    Regards,
    Peter

    #972509

    Hi, Peter. I just wanted to be clear that I don’t need support on this issue. I just wanted to post a how-to on this to help other visitors.

    Thanks!

    #972856

    Hi,

    Great, thanks for posting that, much appreciated :-)

    Best regards,
    Rikard

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.