• 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

Move entire inside an tag

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 › Design Tips and Tricks › Move entire inside an tag

This topic is: not resolved

Tagged: hooks, markup

  • This topic has 1 reply, 1 voice, and was last updated 9 years, 8 months ago by lucaslem.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • September 27, 2013 at 12:57 pm #64498
    lucaslem
    Member

    Hello, I am trying to wrap the post entries on the archive pages inside an link element in order to make the entire post blocks clickable rather than the title (custom child theme of genesis framework). Here is a link which illustrates what I am attempting: http://www.barkpr.com/client-press/

    While the current markup reads:

    <article class="post...">
    	<header class="entry-header">
    		<h1 class="entry-title" itemprop="headline">
    			<a href="..."</a>
    		</h1> 
    		<p class="entry-meta"></p>
    	</header>
    	<div class="entry-content">
    	</div>
    	<p class="entry-meta"></p>
    </article>

    I would like to put everything inside the "article" inside an "a" tag like so:

    <article class="post...">
    	<a href="permalink">
    		<header class="entry-header">
    			<h1 class="entry-title" itemprop="headline">
    				<a href="..."></a>
    			</h1> 
    			<p class="entry-meta"></p>
    		</header>
    		<div class="entry-content">
    		</div>
    		<p class="entry-meta"></p>
    	</a>
    </article>

    How can I access genesis_before_entry_header and genesis_after_entry_meta (I know I just made those up)? Here is my example code to illustrate what I am trying to achieve:

    //* Place articles inside <a> tag to make entire block clickable
    add_action( 'genesis_before_entry_header', 'ismh_article_open_link' );
    function ismh_article_open_link () {
        if ( is_archive() || ! is_singular() ) {
            echo '<a href="' . get_permalink() . '">';
        }
    }
    
    add_action( 'genesis_after_entry_meta', 'ismh_article_close_link' );
    function ismh_article_close_link () {
        if ( is_archive() || ! is_singular() ) {
            echo '</a>';
        }
    }
    September 27, 2013 at 2:50 pm #64518
    lucaslem
    Member

    Hmmm, unless this small change requires a custom loop?

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Design Tips and Tricks’ 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