Last active
January 10, 2017 19:00
-
-
Save rgadon107/affe969751c19d7bfbcaa47d904bf2d7 to your computer and use it in GitHub Desktop.
// Final result:
add_action('genesis_before_content', 'render_blog_page_title_after_content_sidebar_wrap' );
/**
-
Render the blog page title on the front and post pages.
-
@SInCE 1.0.0
-
@return void
*/
function render_blog_page_title_after_content_sidebar_wrap() {if ( is_front_page() || is_singular( 'post' ) ) {
include( __DIR__ . '/lib/structure/views/blog-title.php' );
}
}
//Code included from view file (commented out for demonstration purposes):
Yoga St. Louis Blog
// Note: the php echo
command in the view file was necessary to render the site url to the browser. The WP callback by itself
// returns an empty string.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Robert,
There are some structure and functional problems in your code. Let's walk through them.
The first function
The
else
codeblock is not needed at all. The first line should only happen if this web page is the front page OR a single post.The second function
Remove the
else
gatekeeper. It's unnecessary. Why? Think about it. IF this is a front page OR a post, then it returns. Theelse
happens anyway if it's not the front page OR a post. Therefore, it's redundant and not needed.The event is :
genesis_attr_content-sidebar-wrap
.The code will not work until you take those attributes and then apply them yourself to the appropriate markup. Running your code, you get the following markup:
<div open="<div><a %>" class="featured-content" href="="http://sandbox.dev"" title="Yoga St. Louis Blog" close="</a>"><main class="content" id="genesis-content">
That's not what you want.
Rethinking it
I assume that you are trying to insert a blog title into the page. Correct? Then you want to do this instead: