-
-
Save davidvandenbor/5be5f15dd888bcd3fba1 to your computer and use it in GitHub Desktop.
Revisions
-
davidvandenbor renamed this gist
Jul 5, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
Ben revised this gist
Apr 1, 2013 . 1 changed file with 10 additions and 3 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 @@ -73,6 +73,13 @@ Modifying the query on Category Page <?php /* Get Single page ------------------------------------------*/ ?> <?php // Get front | home pages $frontpage_id = get_option('page_on_front'); $homepage_id = get_option('page_for_posts'); $page = get_page($frontpage_id); // Get page by Title $page = get_page_by_title('Our Service Areas in Sydney'); ?> <h2><?php echo $page->post_title; ?></h2> <?php echo apply_filters('the_content', $page->post_content); ?> -
Ben revised this gist
Jan 30, 2013 . 1 changed file with 2 additions and 0 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 @@ -15,6 +15,8 @@ <?php endwhile; ?> <?php wp_reset_query(); ?> Modifying the query on Category Page <?php $cat = get_query_var('cat'); query_posts('orderby=menu_order&order=ASC&cat='.$cat); ?> <?php /* Simple create multiple loops ------------------------------------------*/ ?> -
Ben revised this gist
Dec 17, 2012 . 1 changed file with 1 addition and 1 deletion.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 @@ -25,7 +25,7 @@ foreach( $myposts as $post ) : setup_postdata($post); ?> <h1><?php the_title(); ?></h1> <?php endforeach; wp_reset_postdata(); ?> <?php /* Multiple loops with pagination ------------------------------------------*/ ?> -
Ben revised this gist
Nov 21, 2012 . 1 changed file with 5 additions and 2 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 @@ -2,13 +2,15 @@ <?php if (have_posts()) while (have_posts()): the_post(); ?> <h1><?php the_title(); ?></h1> <?php // get_template_part( 'content', 'home' ); ?> <?php endwhile; ?> <?php /* Simple alter main loop ------------------------------------------*/ ?> <?php query_posts('posts_per_page=1&post_type=locations'); ?> <?php if(have_posts()) while (have_posts()) : the_post(); ?> <h1><?php the_title(); ?></h1> <?php // get_template_part( 'content', 'home' ); ?> <?php the_content('read more...'); ?> <?php endwhile; ?> <?php wp_reset_query(); ?> @@ -18,7 +20,7 @@ <?php global $post; $args = array( 'posts_per_page' => 5 ); $myposts = get_posts( $args ); foreach( $myposts as $post ) : setup_postdata($post); ?> @@ -38,10 +40,11 @@ $tmp = $wp_query; $wp_query = null; $wp_query = new WP_Query(array( 'posts_per_page' => 2, 'paged' => $paged )); while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?> <h1><?php the_title(); ?></h1> <?php // get_template_part( 'content', 'home' ); ?> <?php endwhile; ?> <?php // previous_posts_link('← Previous Post'); ?> <?php // next_posts_link('Next Post →'); ?> -
Ben revised this gist
Nov 15, 2012 . 1 changed file with 7 additions and 1 deletion.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 @@ -64,4 +64,10 @@ query_posts('posts_per_page=1&post_type=locations'); $more=0; // ... ?> <?php /* Get Single page ------------------------------------------*/ ?> <?php $areas = get_page_by_title('Our Service Areas in Sydney'); ?> <h2><?php echo $areas->post_title; ?></h2> <?php echo apply_filters('the_content', $areas->post_content); ?> -
Ben revised this gist
Nov 13, 2012 . 1 changed file with 3 additions and 2 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 @@ -43,9 +43,10 @@ ?> <h1><?php the_title(); ?></h1> <?php endwhile; ?> <?php // previous_posts_link('← Previous Post'); ?> <?php // next_posts_link('Next Post →'); ?> <?php // wp_pagenavi( array( 'query' => $wp_query ) ); ?> <?php $wp_query = null; $wp_query = $tmp; ?> -
Ben revised this gist
Nov 13, 2012 . 1 changed file with 6 additions and 0 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,3 +1,9 @@ <?php /* Main loop ------------------------------------------*/ ?> <?php if (have_posts()) while (have_posts()): the_post(); ?> <h1><?php the_title(); ?></h1> <?php endwhile; ?> <?php /* Simple alter main loop ------------------------------------------*/ ?> <?php query_posts('posts_per_page=1&post_type=locations'); ?> -
Ben revised this gist
Nov 13, 2012 . 2 changed files with 60 additions and 18 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 @@ -0,0 +1,60 @@ <?php /* Simple alter main loop ------------------------------------------*/ ?> <?php query_posts('posts_per_page=1&post_type=locations'); ?> <?php if(have_posts()) while (have_posts()) : the_post(); ?> <h1><?php the_title(); ?></h1> <?php the_content('read more...'); ?> <?php endwhile; ?> <?php wp_reset_query(); ?> <?php /* Simple create multiple loops ------------------------------------------*/ ?> <?php global $post; $args = array( 'numberposts' => 5 ); $myposts = get_posts( $args ); foreach( $myposts as $post ) : setup_postdata($post); ?> <h1><?php the_title(); ?></h1> <?php endforeach; ?> <?php /* Multiple loops with pagination ------------------------------------------*/ ?> <?php // sidebar fix global $paged; // home page fix if ( get_query_var('paged') ) $paged = get_query_var('paged'); else if ( get_query_var('page') ) $paged = get_query_var('page'); else $paged = 1; $ppp = get_option('posts_per_page'); $tmp = $wp_query; $wp_query = null; $wp_query = new WP_Query(array( 'numberposts' => 5 )); while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?> <h1><?php the_title(); ?></h1> <?php endwhile; ?> <?php // previous_posts_link('← Previous Post'); next_posts_link('Next Post →'); ?> <?php wp_pagenavi( array( 'query' => $wp_query ) ); $wp_query = null; $wp_query = $tmp; ?> <?php /* Various Looping-related fixes ------------------------------------------*/ ?> <?php /** * Use 'read more' in a post listing on a page * See: http://codex.wordpress.org/Customizing_the_Read_More#How_to_use_Read_More_in_Pages */ ?> <?php global $more; query_posts('posts_per_page=1&post_type=locations'); $more=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 @@ -1,18 +0,0 @@ -
Ben created this gist
Jul 20, 2012 .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,18 @@ <?php // sidebar fix global $paged; // home page fix if ( get_query_var('paged') ) $paged = get_query_var('paged'); else if ( get_query_var('page') ) $paged = get_query_var('page'); else $paged = 1; $ppp = get_option('posts_per_page'); ?> <?php query_posts('posts_per_page='.$ppp.'&paged='.$paged); ?> <?php if(have_posts()) while (have_posts()) : the_post(); ?> <h1><?php the_title(); ?></h1> <?php the_excerpt(); ?> <?php endwhile; ?> <p><?php previous_posts_link('← Previous Post'); ?></p> <p><?php next_posts_link('Next Post →'); ?></p> <?php // wp_pagenavi(); ?> <?php wp_reset_query(); ?>