Simple WordPress / PHP query

This is a relatively simple question, but I haven’t been able to find a solution. I’m looking to load a custom image size for each post and I want to do it by using the title of the subheading (A WordPress add-on). The reason I am using subheading and not ‘heading’, ‘category’ or ‘tags’ is because they are all playing a separate role within the site.

I need to take a simple WordPress command:

Read More
<?php the_post_thumbnail(); ?>

And place the name of the subheading within it:

<?php if (function_exists('the_subheading')) { the_subheading(); } ?>

So it would look like this:

<?php the_post_thumbnail('the name of the subheading here'); ?>

Any help much appreciated!

Related posts

Leave a Reply

1 comment

  1. if (function_exists('the_subheading')) {
    $subheading = get_the_subheading($postID);
    the_post_thumbnail($subheading);
    }
    

    Note: $postID can be written also in other way, it depends how you are using the post id. Or just have $subheading = get_the_subheading();

    Good luck!