Skip to content

Instantly share code, notes, and snippets.

@Codevz
Last active June 18, 2022 10:35
Show Gist options
  • Save Codevz/33a69e8b72ebc8373e5487273adefe9c to your computer and use it in GitHub Desktop.
Save Codevz/33a69e8b72ebc8373e5487273adefe9c to your computer and use it in GitHub Desktop.
XTRA WP Theme - Add content before archive content, https://xtratheme.com/
<?php
/**
* With this function you can add any custom contetn, HTML, shortcode before any archive pages.
*
* @var $post_type post type slug
*/
function my_prefix_before_archive_content( $post_type ) {
if ( $post_type === 'post' ) {
echo 'This is my custom content for posts archive ...';
} else if ( $post_type === 'product' ) {
echo 'This is my custom content for WooCommerce archive ...';
}
}
add_action( 'codevz_before_archive_content', 'my_prefix_before_archive_content' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment