Community Forums › Forums › Archived Forums › General Discussion › Editing single.php
Tagged: genesis_header, hook
- This topic has 6 replies, 3 voices, and was last updated 9 years, 5 months ago by Ren Ventura.
-
AuthorPosts
-
April 13, 2015 at 4:17 pm #147797Dean GrayMember
Hi,
I'm trying to edit the Agency Pro Theme, I want to edit the equivalent to single.php.
What I'm trying to do is add a conditional to post title, by using the in_category() function. That if the post category is work add an anchor tag. However I can't find the html, I thought I found it under structure/header.php but I couldn't see it.
I know I need one of these two hook genesis_entry_header or genesis_header but I can't find it original hook to copy the html can anyone advise me where to look for this hook or hooks in general.
April 13, 2015 at 5:56 pm #147804DTHkellyMemberApril 14, 2015 at 2:14 am #147829Dean GrayMemberHi,
Thank you for the links but I have installed the plugin and it doesn't appear in the admin panel which looks to be a known issue with no resolve as of yet. I know, the hook i need is genesis_entry_header but I can't find it in the file structure.
Are you able to help me find this last bit of information
April 14, 2015 at 3:51 am #147842DTHkellyMemberNot sure why the plugin isn't visible - I use it on all my Genesis sites.
Some reference:
http://www.carriedils.com/genesis-framework-php/Includes order that hooks load:
April 14, 2015 at 4:08 pm #147927Dean GrayMemberThank you for the extra links the 2nd link is very useful and I think holds my answer.
Just got to read through his tutorial I know the the hook i need to amend is genesis_entry_header i just need to find the original hook so I can then amend it.
April 22, 2015 at 3:43 pm #148840Dean GrayMemberHopefully people will see this so I finally get the framework and I've removed the original function and added my own now what is probably the easy bit for people to help with. So I'm editing the function genesis_do_post_title.
As it says in the original post I want to add a conditional so if the category of the post is "work" in my case. I want to wrap the post_title in a anchor tag below if original function now it looks like the functionality is already but link part looks like its saying if the post isn't singular add a href. Any have any advise on how if should edit this i.e. just add a conditional at the end or amend the link if??
$title = apply_filters( 'genesis_post_title_text', get_the_title() ); if ( 0 === mb_strlen( $title ) ) return; //* Link it, if necessary if ( ! is_singular() && apply_filters( 'genesis_link_post_title', true ) ) $title = sprintf( '<a href="%s" rel="bookmark">%s</a>', get_permalink(), $title ); //* Wrap in H1 on singular pages $wrap = is_singular() ? 'h1' : 'h2'; //* Also, if HTML5 with semantic headings, wrap in H1 $wrap = genesis_html5() && genesis_get_seo_option( 'semantic_headings' ) ? 'h1' : $wrap; //* Build the output $output = genesis_markup( array( 'html5' => "<{$wrap} %s>", 'xhtml' => sprintf( '<%s class="entry-title">%s</%s>', $wrap, $title, $wrap ), 'context' => 'entry-title', 'echo' => false, ) ); $output .= genesis_html5() ? "{$title}</{$wrap}>" : ''; echo apply_filters( 'genesis_post_title_output', "$output \n" );
April 23, 2015 at 4:36 pm #148950Ren VenturaMemberYou do not want to modify the original code. Editing Genesis core is going to result in your changes being erased when Genesis is updated. Use the
genesis_post_title_output
filter that the post title is passed through at the end of that function. This will allow you to customize the output without touching the core files.
Web & Software Developer & Blogger | RenVentura.com | Follow Me on Twitter @CLE_Ren
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.