Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpmarchand/83ac754e292bbf3f700f to your computer and use it in GitHub Desktop.
Save jpmarchand/83ac754e292bbf3f700f to your computer and use it in GitHub Desktop.
Swap post title and image position on archive page in Genesis. Source: https://wpbeaches.com/swap-post-title-image-position-archive-page-genesis/
<?php
//* Swap post title and image position on archive page
add_action('genesis_before_content', 'customprefix_swap_title_image_archive');
function customprefix_swap_title_image_archive() {
if ( is_archive() || is_home() ) {
remove_action('genesis_entry_content', 'genesis_do_post_image', 8);
add_action('genesis_entry_header', 'genesis_do_post_image', 8);
}
}
<?php
//* Swap post title and image position on CPT archive
add_action('genesis_before_content', 'customprefix_swap_title_image_cpt');
function customprefix_swap_title_image_cpt() {
if ( is_post_type_archive('portfolio') ) { // Replace "portfolio" with your CPT name
remove_action('genesis_entry_content', 'genesis_do_post_image', 8);
add_action('genesis_entry_header', 'genesis_do_post_image', 8);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment