Skip to content

Commit

Permalink
Issue 4: Add home (for blog archive) and search page template files
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbingwide committed Jul 8, 2016
1 parent 38004eb commit d6848f0
Show file tree
Hide file tree
Showing 3 changed files with 189 additions and 0 deletions.
1 change: 1 addition & 0 deletions archive.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php // (C) Copyright Bobbing Wide 2015,2016


/**
* Implement a tighter loop for archives
*
Expand Down
96 changes: 96 additions & 0 deletions home.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?php // (C) Copyright Bobbing Wide 2016



/**
* Implement the loop for the home page
*
* Basically we don't want any content except the featured image
*
* BUT
* one day we might look at {@link https://github.com/desandro/masonry}
*
*/
function genesis_a2z_home_do_loop() {
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
//do_action( 'genesis_before_entry' );
printf( '<article %s>', genesis_attr( 'entry' ) );
//do_action( 'genesis_before_entry_content' );
//printf( '<div %s>', genesis_attr( 'entry-content' ) );
do_action( 'genesis_entry_header' );
do_action( 'genesis_entry_content' );
//echo '</div>';
//do_action( 'genesis_after_entry_content' );
do_action( 'genesis_entry_footer' );
echo '</article>';
//do_action( 'genesis_after_entry' );
}
do_action( 'genesis_after_endwhile' );
} else {
do_action( 'genesis_loop_else' );
}
}

/**
* Enqueue special styles for archives
*/
function genesis_a2z_after_footer() {
bw_trace2();
bw_backtrace();
wp_enqueue_style( "archive-css", get_stylesheet_directory_uri() . '/archive.css', array() );
}

/*
* Output from genesistant
*
* We don't want either post_content nor post_content_nav
* but we do want the image and may need the post permalink
* but this should be before the image
*
* `
* <!--
* action genesis_entry_content genesis_loop,genesis_entry_content
*
* : 8 genesis_do_post_image;1
* : 10 genesis_do_post_content;1
* : 12 genesis_do_post_content_nav;1
* : 14 genesis_do_post_permalink;1-->
*/
//add_action( "genesis_entry_content", "genesis_do_post_content", 10 );
//add_action( "genesis_entry_content", "genesis_do_post_content_nav", 12 );
add_action( "genesis_entry_content", "genesis_do_post_permalink", 14 );

add_action( "genesis_entry_content", "genesis_do_post_permalink", 6 );

// Not necessary to remove these hooks if we don't invoke the action

//remove_action( "genesis_entry_footer", 'genesis_oik_post_info' );
//remove_action( "genesis_entry_footer", "genesis_entry_footer_markup_open", 5);
//remove_action( "genesis_entry_footer", "genesis_entry_footer_markup_close", 15 );
//remove_action( "genesis_entry_header", "genesis_do_post_format_image", 4 );

remove_action( "genesis_loop", "genesis_do_loop" );
add_action( "genesis_loop", "genesis_a2z_home_do_loop" );


//add_action( 'genesis_entry_header', 'genesis_post_info', 12 );


add_action( 'genesis_entry_footer', 'genesis_post_meta' );

add_action( 'genesis_entry_header', 'genesis_do_post_title' );



/*
* Use our own sidebar for archives
*/
remove_action( 'genesis_after_content', 'genesis_get_sidebar' );
add_action( 'genesis_after_content', 'genesis_oik_get_sidebar' );


//add_action( "genesis_after_footer", "genesis_a2z_after_footer" );
add_action( "wp_enqueue_scripts", "genesis_a2z_after_footer" );
genesis();
92 changes: 92 additions & 0 deletions search.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?php // (C) Copyright Bobbing Wide 2016

/**
* Implement the loop for the search page
*
* Basically we don't want any content except the title.
*
*
*/
function genesis_a2z_search_do_loop() {
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
//do_action( 'genesis_before_entry' );
printf( '<article %s>', genesis_attr( 'entry' ) );
//do_action( 'genesis_before_entry_content' );
//printf( '<div %s>', genesis_attr( 'entry-content' ) );
do_action( 'genesis_entry_header' );
//do_action( 'genesis_entry_content' );
//echo '</div>';
//do_action( 'genesis_after_entry_content' );
//do_action( 'genesis_entry_footer' );
echo '</article>';
//do_action( 'genesis_after_entry' );
}
do_action( 'genesis_after_endwhile' );
} else {
do_action( 'genesis_loop_else' );
}
}

/**
* Enqueue special styles for search
*/
function genesis_a2z_search_after_footer() {
bw_trace2();
bw_backtrace();
wp_enqueue_style( "search-css", get_stylesheet_directory_uri() . '/search.css', array() );
}

/*
* Output from genesistant
*
* We don't want either post_content nor post_content_nav
* but we do want the image and may need the post permalink
* but this should be before the image
*
* `
* <!--
* action genesis_entry_content genesis_loop,genesis_entry_content
*
* : 8 genesis_do_post_image;1
* : 10 genesis_do_post_content;1
* : 12 genesis_do_post_content_nav;1
* : 14 genesis_do_post_permalink;1-->
*/
//add_action( "genesis_entry_content", "genesis_do_post_content", 10 );
//add_action( "genesis_entry_content", "genesis_do_post_content_nav", 12 );
add_action( "genesis_entry_content", "genesis_do_post_permalink", 14 );

add_action( "genesis_entry_content", "genesis_do_post_permalink", 6 );

// Not necessary to remove these hooks if we don't invoke the action

//remove_action( "genesis_entry_footer", 'genesis_oik_post_info' );
//remove_action( "genesis_entry_footer", "genesis_entry_footer_markup_open", 5);
//remove_action( "genesis_entry_footer", "genesis_entry_footer_markup_close", 15 );
//remove_action( "genesis_entry_header", "genesis_do_post_format_image", 4 );

remove_action( "genesis_loop", "genesis_do_loop" );
add_action( "genesis_loop", "genesis_a2z_search_do_loop" );


//add_action( 'genesis_entry_header', 'genesis_post_info', 12 );


//add_action( 'genesis_entry_footer', 'genesis_post_meta' );

add_action( 'genesis_entry_header', 'genesis_do_post_title' );



/*
* Use our own sidebar for archives
*/
remove_action( 'genesis_after_content', 'genesis_get_sidebar' );
add_action( 'genesis_after_content', 'genesis_oik_get_sidebar' );


//add_action( "genesis_after_footer", "genesis_a2z_after_footer" );
add_action( "wp_enqueue_scripts", "genesis_a2z_search_after_footer" );
genesis();

0 comments on commit d6848f0

Please sign in to comment.