Replace WP Show Posts title with a custom field
I was once faced with the challenge to replace the normal post title with a custom one while using the WP Show Posts plugin. There is a way to do that through a custom hook element and the WP Show Posts wpsp_before_header
hook.
<?php add_action( 'wpsp_before_header','wpsp_add_custom_meta' ); function wpsp_add_custom_meta() { $meta = get_post_meta( get_the_ID(), 'custom_title', true ); if ( isset( $meta ) && '' !== $meta ) $permalink = get_permalink( get_the_ID() ); echo '<h2 class="custom-entry-title" itemprop="headline"><a href="' . $permalink . '"' . 'rel="bookmark"> ' . $meta . '</a>' . '</h2>'; } ?>
Use the wp_head hook and activate Execute PHP.
You also need to deactivate the title from WP Show Posts’ Content tab so that you won’t get duplicated titles!
Replace custom_title
with the name of your custom fields. It also works with ACF!