• 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

Add a div around my entry-title and breadcrumb trail

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 › Add a div around my entry-title and breadcrumb trail

This topic is: not resolved

Tagged: add a div, breadcrumb, entry-title

  • This topic has 4 replies, 2 voices, and was last updated 6 years, 1 month ago by leighm.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • April 4, 2016 at 9:19 am #182887
    leighm
    Member

    Hi,

    I've moved my entry-title and breadcrumb trail above the content and sidebar using this code:

    
    //Moves titles above content and sidebar
    remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
    add_action( 'genesis_after_header', 'genesis_do_post_title', 20 );
    //this removes post titles from blog archive pages as well
    //Add titles back to home page, single posts, categeory archives and one specific page
    add_action('get_header', 'move_other_post_titles');
    function move_other_post_titles() {
        if (is_home() || is_single() || is_page('contact-me') || is_category()) { // added conditional 'or is_single' and 'or is_category'
            remove_action( 'genesis_after_header', 'genesis_do_post_title', 20 );
            add_action( 'genesis_entry_header', 'genesis_do_post_title' );
        }
    }
    
    //* Reposition the breadcrumbs
    remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
    add_action( 'genesis_after_header', 'genesis_do_breadcrumbs', 19);
    

    The two divs now appear between the nav tag and the site-inner div, and do not have any div's wrapped directly around them. I want to give them 2 div's: 1 to apply the wrap class so they stay within the max width of the site, and outside that I want another div, so I can add a background image that will extend the full width of the view port. Something like this:

    
    <div class="title-background">
      <div class="wrap">
        <div class="breadcrumb" itemprop="breadcrumb" itemscope="" itemtype="http://schema.org/BreadcrumbList">You are here: <span class="breadcrumb-link-wrap" itemprop="itemListElement" itemscope="" itemtype="http://schema.org/ListItem"><a href="http://localhost/smcu/">
          <span itemprop="name">Home</span></a></span> <span aria-label="breadcrumb separator">/</span> 
          <span class="breadcrumb-link-wrap" itemprop="itemListElement" itemscope="" itemtype="http://schema.org/ListItem">
            <a href="http://localhost/smcu/sample/"><span itemprop="name">Sample Page</span></a></span> <span aria-label="breadcrumb separator">/
          </span> Sub Page 1.1</div>
    
    <h1 class="entry-title" itemprop="headline">Sub Page 1.1</h1></div></div>
    

    The div's with the class names title-background, and wrap are the ones I'd like to add and close them after the h1 tag.

    Is there some way I can do this in genesis?

    Thanks.

    April 5, 2016 at 2:32 pm #183012
    carasmo
    Participant

    Not exactly sure what you are doing, why remove and add back? Use conditionals for just those post types in the array in the variable.

    /** 
     *
     * Move Post Titles and Breadcrumbs on $post_types
     * Add presentational .wrap
     *
     */
    function prefix_move_post_titles() {
    
    	$post_types = array(  'post',  'page'  ); // add CPTs here too with the same syntax
        
    	if ( is_singular( $post_types ) ) { 
            
    		remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
    		remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
            
    		echo '<div class="wrap">';
    			genesis_do_post_title();
    			genesis_do_breadcrumbs();
    		echo '</div>';
    
    	}
    }
    add_action( 'genesis_after_header', 'prefix_move_post_titles' );

    Genesis Theme Customization and Help

    April 6, 2016 at 1:55 am #183024
    leighm
    Member

    That's perfect, Carasmo. That's exactly what I wanted to do. I wasn't aware that I could echo markup in the function like that. This is my first proper site using Genesis, so still very much on a learning curve. Thanks so much for your help.

    On another note: I notice on the sites that you develop, you add a + sign to menu items that have sub items, which is great. Is that a function or how is that done? I hope you don't mind me using your work for inspiration : )

    Maybe I should open up a new ticket to ask this specific question?

    April 6, 2016 at 4:33 am #183032
    carasmo
    Participant

    Thanks! Re: the submenus, that is not a function, it's mostly CSS and jQuery. Due to a lack of time, I don't have a tutorial on how it's done, probably next month or two.


    Genesis Theme Customization and Help

    April 6, 2016 at 4:50 am #183034
    leighm
    Member

    No problem. Thanks Carasmo. I'll look into myself in the meantime.

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 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

© 2022 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