[Resolved] Retrieve Custom Fields by Name With Content Type ID?
I’m building a single scrolling page with each section represented as a custom content type, and each using a similarly structured custom fields.
The issue I’m having is pulling in the image field within each section using the :to_image_src method.
Here’s an example
$hero = get_post_complete(5);
$compay = get_post_complete(10);
$services = get_post_complete(15);
Pull in content in a section via array:
<h1><?php print $hero[‘mainheading’]; ?></h1>
<h5><?php print $hero[‘subheading’]; ?></h5>
Now I get stuck trying to pull in the image..
wp_get_attachment_image($image_id); works, but I don’t want to have to get the ID every time, I need it to be dynamic.
<img src=”<?php print_custom_field(‘flyout_image:to_image_src’); ?>” /> does not work in this context.
<img src=”<?php print_custom_field(‘flyout_image:to_image_src’); ?>” />
<?php print $hero[‘flyout_image’]; ?> returns the number as you know.
<?php print $hero[‘flyout_image:to_image_src’]; ?> does not work.
As you can see, I’m lost and have tried many other combinations in addition to the ones illustrated above. Any help would be fantastic.
- The topic ‘[Resolved] Retrieve Custom Fields by Name With Content Type ID?’ is closed to new replies.