To move the Archive Intro Text from the top (default) position to the bottom of the page (after shop loop)
/* Remove the Archive Headline and Text from the default location */ | |
remove_action( 'genesis_archive_title_descriptions', 'genesis_do_archive_headings_open', 5); | |
remove_action( 'genesis_archive_title_descriptions', 'genesis_do_archive_headings_close', 15); | |
remove_action( 'genesis_archive_title_descriptions', 'genesis_do_archive_headings_headline', 10); | |
remove_action( 'genesis_archive_title_descriptions', 'genesis_do_archive_headings_intro_text', 12); | |
/* Now, add it back at the bottom */ | |
add_action( 'woocommerce_after_shop_loop', 'ar_add_custom_hook_archive_description', 8); | |
add_action( 'ar_add_wc_archive_descr_text' , 'ar_do_custom_archive_description_text', 7, 3); | |
function ar_add_custom_hook_archive_description() { | |
global $wp_query; | |
if ( ! is_category() && ! is_tag() && ! is_tax() ) { | |
return; | |
} | |
$term = is_tax() ? get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ) : $wp_query->get_queried_object(); | |
if ( ! $term ) { | |
return; | |
} | |
$heading = get_term_meta( $term->term_id, 'headline', true ); | |
if ( empty( $heading ) && genesis_a11y( 'headings' ) ) { | |
$heading = $term->name; | |
} | |
$intro_text = get_term_meta( $term->term_id, 'intro_text', true ); | |
$intro_text = apply_filters( 'genesis_term_intro_text_output', $intro_text ? $intro_text : '' ); | |
do_action( 'ar_add_wc_archive_descr_text', $heading, $intro_text, 'taxonomy-archive-description' ); | |
} | |
function ar_do_custom_archive_description_text( $heading = '', $intro_text = '', $context = '' ) { | |
if ( $heading || $intro_text ) { | |
genesis_markup( array( | |
'open' => '<div %s>', | |
'context' => $context, | |
) ); | |
} | |
if ( $context && $intro_text ) { | |
echo $intro_text; | |
} | |
if ( $heading || $intro_text ) { | |
genesis_markup( array( | |
'close' => '</div>', | |
'context' => $context, | |
) ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment