• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Editing single.php

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Editing single.php

This topic is: not resolved

Tagged: genesis_header, hook

  • This topic has 6 replies, 3 voices, and was last updated 7 years, 9 months ago by Ren Ventura.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • April 13, 2015 at 4:17 pm #147797
    Dean Gray
    Member

    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 #147804
    DTHkelly
    Member

    Hooks:

    http://genesistutorials.com/visual-hook-guide/

    https://wordpress.org/plugins/genesis-visual-hook-guide/

    April 14, 2015 at 2:14 am #147829
    Dean Gray
    Member

    Hi,

    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 #147842
    DTHkelly
    Member

    Not 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:
    http://designsbynickthegeek.com/tutorials/genesis-explained-the-framework

    April 14, 2015 at 4:08 pm #147927
    Dean Gray
    Member

    Thank 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 #148840
    Dean Gray
    Member

    Hopefully 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 #148950
    Ren Ventura
    Member

    You 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

  • Author
    Posts
Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble