-
-
Save GaryJones/2cf5e711bee56f11f3f8 to your computer and use it in GitHub Desktop.
Revisions
-
GaryJones revised this gist
May 19, 2015 . 2 changed files with 32 additions and 24 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,24 +0,0 @@ This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ <?php add_action( 'genesis_entry_content', 'kat_grid_content', 9 ); /** * Change the number of words in excerpt if in the grid loop and customize READ MORE, add accessibility. */ function kat_grid_content() { // Make sure we're in the grid loop. if ( ! apply_filters( 'is_genesis_grid_loop', false ) ) { return; } // Change length of teaser. $length = 55; if ( in_array( 'teaser', get_post_class() ) ) { $length = 25; } echo '<p>' . wp_trim_words( get_the_excerpt(), $length ) . '</p>'; // Display more link. printf( '<p class="more-link"><a href="%1$s">%2$s<span class="screen-reader-text"> %3$s %4$s</span></a></p>', esc_url( get_permalink() ), esc_html__( 'Read more', 'your-text-domain' ), esc_html_x( 'about', 'i.e. Read more about A Post Title', 'your-text-domain' ), esc_html( get_the_title() ) ); // Remove default content so we don't get both. remove_action( 'genesis_entry_content', 'genesis_do_post_content' ); } -
katmoody created this gist
May 17, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ /** * Change the number of words in excerpt if in the grid loop and customize READ MORE, add accessibility */ function kat_grid_content() { // First, we make sure we're in the grid loop. if( ! apply_filters( 'is_genesis_grid_loop', false ) ) return; // Change length if teaser if( in_array( 'teaser', get_post_class() ) ) $length = 25; else $length = 55; echo '<p>' . wp_trim_words( get_the_excerpt(), $length ) . '</p>'; // Display more link // echo '<a rel="nofollow" class="more-link" href="' . get_permalink() . '">Continue Reading</a>'; echo '<p class="more-link"><a href="'. get_permalink() .'">' . __( 'Read more', 'genesis' ) . '<span class="screen-reader-text"> ' . __( 'about' ) . " " . get_the_title() . "</span></a></p>"; // Remove default content so we don't get both remove_action( 'genesis_entry_content', 'genesis_do_post_content' ); } add_action( 'genesis_entry_content', 'kat_grid_content', 9 );