Making a post-title full-width

Community Forums Forums Design Tips and Tricks Making a post-title full-width

This topic is: not resolved

This topic contains 3 replies, has 2 voices, and was last updated by  SoZo 1 year, 7 months ago.

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

    SarahFoxes
    Participant

     

    Hey everyone,

    So I’m ok with modifying code and regular things but I am just stumped with this trick.  I’m looking for a way to make the ‘News’ child-theme’s post title full-width with a (content-sidebar) layout. So the content and sidebar would still be in-line, just stretch the whole title across and content and side-bar right underneath it.

    I know I would have to move the title out of the ‘content’ section but when I asked tech-support here they also said:

    This requires some PHP edits. I don’t have the exact code for this because it will require some conditional logic. Basically you remove/add the title like
    remove_action( ‘genesis_post_title’, ‘genesis_do_post_title’ );
    add_Action( ‘genesis_before_content’, ‘genesis_do_post_title’ );

    The only problem is, this will really mess things up on archive pages including the blog page template. So you need a conditional action that will load this on single posts and pages, but not the blog page template.

    So I have to worry about that too, which is a really good catch since I didn’t think of that.  They said I should ask here.  If anyone has done this sort of thing before it would be a HUGE help, and then I’ll share the fix for people to use on all the themes (since they are all so similar in basic design).

    Thanks for reading :)

    Sarah

    #2184

    SoZo
    Moderator
    Post count: 1573

    You can learn about conditional tags here. And the basic structure of a function is

    add_action(‘name_of_hook_goes_here’, ‘function_name_here’);
    function function_name_here() {
    conditional_code_goes_here {
    WHAT YOU WANT OUTPUT IF CONDITION IS MET GOES HERE
    }
    }

    And a function name can be anything you want as long as it’s not already used by another function

    So for what you are after it would go something like:

    add_action(‘genesis_init’, ‘move_title’);
    function move_title() {
    if( is_single() || is_page() || ! is_page_template(‘page_blog.php’) ) {
    remove_action( ‘genesis_post_title’, ‘genesis_do_post_title’ );
    add_Action( ‘genesis_before_content’, ‘genesis_do_post_title’ );
    }
    }

     


    John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography

    #2195

    SarahFoxes
    Participant

    i will try plugging this in tonight and i’ll see what happens. Where should i be putting this code for the best chance of success?

    #2206

    SoZo
    Moderator
    Post count: 1573

    You can put it anywhere as long as it’s not in the middle of another function. To be safe you can tack it on to the end of the file.


    John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.