If you know the ID of post or page you can access the custom fields by using the {meta...}
tag:
1 2 3 | {meta post_id="23" assign_to="custom_fields"} {dump var="custom_fields"} |
{meta post_id="23" assign_to="custom_fields"} {dump var="custom_fields"}
This should output an array similar to the one below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | array(6) { ["success"]=> bool(true) ["message"]=> string(7) "success" ["action"]=> string(14) "appc_post_meta" ["route"]=> string(14) "appc.post.meta" ["post_id"]=> string(3) "513" ["data"]=> array(5) { ["_edit_lock"]=> string(13) "1431444730:11" ["_edit_last"]=> string(2) "11" ["_thumbnail_id"]=> string(3) "509" ["_wp_page_template"]=> string(7) "default" ["icon"]=> string(32) "/resources/img/features-ico2.png" } } |
array(6) { ["success"]=> bool(true) ["message"]=> string(7) "success" ["action"]=> string(14) "appc_post_meta" ["route"]=> string(14) "appc.post.meta" ["post_id"]=> string(3) "513" ["data"]=> array(5) { ["_edit_lock"]=> string(13) "1431444730:11" ["_edit_last"]=> string(2) "11" ["_thumbnail_id"]=> string(3) "509" ["_wp_page_template"]=> string(7) "default" ["icon"]=> string(32) "/resources/img/features-ico2.png" } }
Here is a complete example that show how to request children pages and their custom fields meta data:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | {pages child_of="content-features" assign_to="features_pages"} <div id="features"> <div class="container"> <div class="section_header"> <h3>Features</h3> </div> {foreach $features_pages.data as $feature} {meta post_id="{$feature.ID}" assign_to="meta"} {dump var="meta"} <div class="row feature"> <div class="col-sm-6 {if $feature@index%2 == 1}pic-right{/if}"> <img src="{$feature.post_thumbnail}" class="{if $feature@index%2 == 1}pull-right{/if} img-responsive" alt="{$feature.post_thumbnail}"/> </div> <div class="col-sm-6 info{if $feature@index%2 == 1}-left{/if}"> <h3> <img src="{$meta.data.icon}" /> {$feature.post_title} </h3> {$feature.post_content_filtered} </div> </div> {/foreach} </div> </div> |
{pages child_of="content-features" assign_to="features_pages"} <div id="features"> <div class="container"> <div class="section_header"> <h3>Features</h3> </div> {foreach $features_pages.data as $feature} {meta post_id="{$feature.ID}" assign_to="meta"} {dump var="meta"} <div class="row feature"> <div class="col-sm-6 {if $feature@index%2 == 1}pic-right{/if}"> <img src="{$feature.post_thumbnail}" class="{if $feature@index%2 == 1}pull-right{/if} img-responsive" alt="{$feature.post_thumbnail}"/> </div> <div class="col-sm-6 info{if $feature@index%2 == 1}-left{/if}"> <h3> <img src="{$meta.data.icon}" /> {$feature.post_title} </h3> {$feature.post_content_filtered} </div> </div> {/foreach} </div> </div>