WordPress.org

Forums

Responsive
A simple(?) question about how this theme works... (2 posts)

  1. soldierblue
    Member
    Posted 9 months ago #

    Hi all.

    I've started some tutorials about theme development and I have been creating some basic themes. I've been looking through some popular themes so I can follow the structure and learn. In the Responsive theme I noticed this code.

    <?php if( have_posts() ) : ?>
    
    		<?php while( have_posts() ) : the_post(); ?>
    
    			<?php get_template_part( 'loop-header' ); ?>
    
    			<?php responsive_entry_before(); ?>
    			<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    				<?php responsive_entry_top(); ?>
    
    				<?php get_template_part( 'post-meta-page' ); ?>
    
    				<div class="post-entry">
    					<?php the_content( __( 'Read more ›', 'responsive' ) ); ?>
    					<?php wp_link_pages( array( 'before' => '<div class="pagination">' . __( 'Pages:', 'responsive' ), 'after' => '</div>' ) ); ?>
    				</div><!-- end of .post-entry -->
    
    				<?php get_template_part( 'post-data' ); ?>
    
    				<?php responsive_entry_bottom(); ?>
    			</div><!-- end of #post-<?php the_ID(); ?> -->
    			<?php responsive_entry_after(); ?>
    
    			<?php responsive_comments_before(); ?>
    			<?php comments_template( '', true ); ?>
    			<?php responsive_comments_after(); ?>
    
    		<?php
    		endwhile;

    I'm trying to figure out what the following functions do:

    <?php responsive_entry_before(); ?>
    <?php responsive_entry_top(); ?>
    <?php responsive_entry_bottom(); ?>
    <?php responsive_entry_after(); ?>

    I don't just want to copy other peoples work, I'm trying to understand good theme building practices but I just can't follow what these functions do. I did a global text search on the theme directory and found them in a file called hooks.php but then I get:

    /** Just before <div id="post">
     *
     * @see index.php
     */
    function responsive_entry_before() {
    	do_action( 'responsive_entry_before' );
    	tha_entry_before();
    }
    
    /** Just after <div id="post">
     *
     * @see index.php
     */
    function responsive_entry_top() {
    	do_action( 'responsive_entry_top' );
    	tha_entry_top();
    }

    So I then I search for tha_entry_before etc and find those entries in a file called tha-theme-hooks.php which has something like this:

    /**
     * Semantic <entry> hooks
     *
     * $tha_supports[] = 'entry';
     */
    function tha_entry_before() {
    	do_action( 'tha_entry_before' );
    }
    
    function tha_entry_after() {
    	do_action( 'tha_entry_after' );
    }
    
    function tha_entry_top() {
    	do_action( 'tha_entry_top' );
    }
    
    function tha_entry_bottom() {
    	do_action( 'tha_entry_bottom' );
    }

    I just feel like I'm chasing my tail. I can't seem to find anything on the web that explains how this stuff works.

    Can anyone explain it or point me in the direction of a tutorial that will help me understand so I can improve my own theme building practices.

    Sorry for the long post...!

  2. Herbert van-Vliet
    Member
    Posted 9 months ago #

    Imo the theme designers will be able to answer properly. But, most likely this will be of interest for you:
    https://github.com/zamoose/themehookalliance (there's a link to a relevant article from there).

Reply

You must log in to post.

About this Theme

About this Topic

Tags

No tags yet.