Move entire inside an tag

Community Forums Forums Design Tips and Tricks Move entire inside an tag

This topic is: not resolved

Tagged: ,

This topic contains 1 reply, has 1 voice, and was last updated by  lucaslem 10 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #64498

    lucaslem
    Participant
    Post count: 88

    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>';
        }
    }
    • This topic was modified 10 months ago by  lucaslem.
    • This topic was modified 10 months ago by  lucaslem.
    #64518

    lucaslem
    Participant
    Post count: 88

    Hmmm, unless this small change requires a custom loop?

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.