Skip to content

Commit

Permalink
Update access and container names. Fix filter issue
Browse files Browse the repository at this point in the history
  • Loading branch information
j-gardner committed Jul 27, 2015
1 parent b97c34b commit 1608bcc
Showing 1 changed file with 44 additions and 44 deletions.
88 changes: 44 additions & 44 deletions includes/class-arconix-faq-display.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ public function getdefaults() {
*
* @return string FAQ information for display
*/
function loop( $args, $echo = false ) {
public function loop( $args, $echo = false ) {
// Merge incoming args with the class defaults
$args = wp_parse_args( $args, $this->getdefaults() );

// Container
$return = '';
$html = '';

// Get the taxonomy terms assigned to all FAQs
$terms = get_terms( 'group' );
Expand Down Expand Up @@ -102,27 +102,27 @@ function loop( $args, $echo = false ) {

if ( $q->have_posts() ) {

$return .= '<h3 id="faq-' . $term->slug . '" class="arconix-faq-term-title arconix-faq-term-' . $term->slug . '">' . $term->name . '</h3>';
$html .= '<h3 id="faq-' . $term->slug . '" class="arconix-faq-term-title arconix-faq-term-' . $term->slug . '">' . $term->name . '</h3>';

if ( $accordion )
$return .= '<div class="arconix-faq-accordion-wrap">';
$html .= '<div class="arconix-faq-accordion-wrap">';

// If the term has a description, show it
if ( $term->description )
$return .= '<p class="arconix-faq-term-description">' . $term->description . '</p>';
$html .= '<p class="arconix-faq-term-description">' . $term->description . '</p>';

// Loop through the rest of the posts for the term
while ( $q->have_posts() ) : $q->the_post();

if ( $accordion )
$return .= $this->accordion_output();
$html .= $this->accordion_output();
else
$return .= $this->toggle_output();
$html .= $this->toggle_output();

endwhile;

if ( $accordion )
$return .= '</div>';
$html .= '</div>';

} // end have_posts()

Expand All @@ -144,31 +144,31 @@ function loop( $args, $echo = false ) {
if ( $q->have_posts() ) {

if ( $accordion )
$return .= '<div class="arconix-faq-accordion-wrap">';
$html .= '<div class="arconix-faq-accordion-wrap">';

while ( $q->have_posts() ) : $q->the_post();

if ( $accordion )
$return .= $this->accordion_output();
$html .= $this->accordion_output();
else
$return .= $this->toggle_output();
$html .= $this->toggle_output();

endwhile;

if ( $accordion )
$return .= '</div>';
$html .= '</div>';
} // end have_posts()

wp_reset_postdata();
}

// Allow complete override of the FAQ content
$return = apply_filters( 'arconix_faq_return', $return );
$html = apply_filters( 'arconix_faq_return', $html, $args );

if ( $echo === true )
echo $return;
echo $html;
else
return $return;
return $html;
}

/**
Expand All @@ -177,38 +177,38 @@ function loop( $args, $echo = false ) {
* @since 1.5.0
* @version 1.6.0
* @param bool $echo echo or return the results
* @return string $return FAQs in an accordion configuration
* @return string $html FAQs in an accordion configuration
*/
function accordion_output( $echo = false ) {
$return = '';
private function accordion_output( $echo = false ) {
$html = '';

// Set up our anchor link
$link = 'faq-' . sanitize_html_class( get_the_title() );

$return .= '<div id="faq-' . get_the_id() . '" class="arconix-faq-accordion-title">';
$return .= get_the_title() . '</div>';
$return .= '<div id="' . $link . '" class="arconix-faq-accordion-content">' . apply_filters( 'the_content', get_the_content() );
$return .= $this->return_to_top( $link );
$return .= '</div>';
$html .= '<div id="faq-' . get_the_id() . '" class="arconix-faq-accordion-title">';
$html .= get_the_title() . '</div>';
$html .= '<div id="' . $link . '" class="arconix-faq-accordion-content">' . apply_filters( 'the_content', get_the_content() );
$html .= $this->return_to_top( $link );
$html .= '</div>';

// Allows a user to completely overwrite the output
$return = apply_filters( 'arconix_faq_accordion_output', $return );
$html = apply_filters( 'arconix_faq_accordion_output', $html );

if ( $echo === true )
echo $return;
echo $html;
else
return $return;
return $html;
}

/**
* Output the FAQs in a toggle style
*
* @since 1.5.0
* @param bool $echo echo or return the results
* @return string $return FAQs in a toggle configuration
* @return string $html FAQs in a toggle configuration
*/
function toggle_output( $echo = false ) {
$return = '';
private function toggle_output( $echo = false ) {
$html = '';

// Grab our metadata
$lo = get_post_meta( get_the_id(), '_acf_open', true );
Expand All @@ -219,22 +219,22 @@ function toggle_output( $echo = false ) {
// Set up our anchor link
$link = 'faq-' . sanitize_html_class( get_the_title() );

$return .= '<div id="faq-' . get_the_id() . '" class="arconix-faq-wrap">';
$return .= '<div id="' . $link . '" class="arconix-faq-title' . $lo . '">' . get_the_title() . '</div>';
$return .= '<div class="arconix-faq-content' . $lo . '">' . apply_filters( 'the_content', get_the_content() );
$html .= '<div id="faq-' . get_the_id() . '" class="arconix-faq-wrap">';
$html .= '<div id="' . $link . '" class="arconix-faq-title' . $lo . '">' . get_the_title() . '</div>';
$html .= '<div class="arconix-faq-content' . $lo . '">' . apply_filters( 'the_content', get_the_content() );

$return .= $this->return_to_top( $link );
$html .= $this->return_to_top( $link );

$return .= '</div>'; // faq-content
$return .= '</div>'; // faq-wrap
$html .= '</div>'; // faq-content
$html .= '</div>'; // faq-wrap

// Allows a user to completely overwrite the output
$return = apply_filters( 'arconix_faq_toggle_output', $return );
$html = apply_filters( 'arconix_faq_toggle_output', $html );

if ( $echo === true )
echo $return;
echo $html;
else
return $return;
return $html;
}

/**