Help with function not working from functions.php
-
Howdy! I need another set of eyes on this. I’m able to get this function to show custom field values when I put the code in the page.php file but when I put it in the functions.php file and call it from the page.php it not displaying the custom field values.
function custom_cont() { global $show_cust_fld; $show_cust_flds = get_post_meta($post->ID, 'page_cat', false); if ($show_cust_flds[0]=="") { ?> <!-- If there are no custom fields, show nothing --> <?php } else { ?> <div class="cust_flds"> <h3>From the Press</h3> <?php foreach($show_cust_flds as $show_cust_fld) { echo '<blockquote><p>'.$show_cust_fld.'</p></blockquote>'; } ?> </div> <?php } ?>
This is how I’m calling the function within the loop from the page.php file.
<?php custom_cont(); ?>
It’s not getting the custom value to display when used in the functions.php file.
Thanks in advance.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Help with function not working from functions.php’ is closed to new replies.