Community Forums › Forums › Design Tips and Tricks › Making a post-title full-width
Tagged: full width, News Theme, title
This topic contains 3 replies, has 2 voices, and was last updated by SoZo 5 months, 3 weeks ago.
-
AuthorPosts
-
November 28, 2012 at 12:42 pm #2074
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
November 28, 2012 at 6:15 pm #2184You 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
November 28, 2012 at 7:28 pm #2195i 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?
November 28, 2012 at 8:50 pm #2206You 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
-
AuthorPosts
You must be logged in to reply to this topic.