Brenta
Brenta

Reputation: 23

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:

<?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!

Upvotes: 2

Views: 130

Answers (1)

user621639
user621639

Reputation:

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!

Upvotes: 1

Related Questions