Skip to content
This repository has been archived by the owner on Mar 4, 2018. It is now read-only.

Commit

Permalink
archives from 'Latest News' section will be based on specific post-ty…
Browse files Browse the repository at this point in the history
…pes/taxonomy/terms defined in theme options. fixes part of #66.
  • Loading branch information
zyml committed May 21, 2013
1 parent 4563c52 commit ff75349
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
11 changes: 7 additions & 4 deletions home.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@

<?php else: ?>

<h1 class="archive-title"><?php _e( 'Blog Archives', 'ar2' ) ?></h1>
<div id="archive-posts">
<?php ar2_render_posts( null, array ( 'type' => ar2_get_theme_option( 'archive_display' ) ), true ) ?>
</div><!-- #archive-posts -->
<?php
// Retrieve latest news section and render the remaining.
$news_section = $ar2_postviews->get_section( 'news-posts' );
$news_section->settings[ 'title' ] = __( 'Blog Archives', 'ar2' );
$news_section->settings[ 'type' ] = ar2_get_theme_option( 'archive_display' );
$news_section->render();
?>

<?php endif; ?>

Expand Down
27 changes: 15 additions & 12 deletions library/classes/postviews-section.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class AR2_PostViews_Section {
public $priority = 10;
public $zone;

public $query;
protected $query;

/**
* Constructor.
Expand Down Expand Up @@ -88,17 +88,7 @@ public function flush_settings( $override = array() ) {
$this->settings = $args;

$this->priority = &$this->settings[ 'priority' ];

/*if ( is_array( $this->settings[ 'persistent' ] ) && !isset( $ar2_options[ 'sections' ][ $this->id ] ) ) {
foreach( $this->settings[ 'persistent' ] as $id ) {
if ( isset( $this->settings[ $id ] ) )
$ar2_options[ 'sections' ][ $this->id ][ $id ] = $this->settings[ $id ];
}
update_option( 'ar2_theme_options', $ar2_options );
}*/

}

/**
Expand All @@ -110,6 +100,19 @@ public function get_field_name( $name ) {
return apply_filters( $this->id . '_field_name', 'ar2_theme_options[sections][' . $this->id . '][' . $name . ']', $name );

}

/**
* Returns the WP_Query object used in this section.
* @since 2.0
*/
public function get_query() {

if ( !is_a( $this->query, 'WP_Query' ) )
$this->prepare_query();

return $this->query;

}

/**
* Parses WP_Query variables based on settings to be used in a new WP_Query object or overriden with an action hook.
Expand Down

0 comments on commit ff75349

Please sign in to comment.