Custom Fields in TD_MODULE_11.PHP

Posted in: Newsmag
Post count: 2

Hello, I need a PHP-code for call a “Custom Field”-Value in “td_module_11.php”. The normal Code doesn’t call the Value.

<?php
function render() {


<div class=”item-details”>
——–> <?php echo get_post_meta($post->ID, ‘1_stichwort’, true);?> <——–
<?php echo $this->get_title();?>

Post count: 6535

Hi

You can echo out a value or a string from the custom field using a code like this one: http://screencast.com/t/XRkkTQhw5Aphttp://screencast.com/t/5qlGC4RQSSyhttp://screencast.com/t/5qlGC4RQSSy

<div class="td-excerpt">
<?php
$post_meta = '<i style="font-size: 20px">' . get_post_meta($this->post->ID, 'my_custom_field', true) . '</i>';
echo $post_meta;
?>
</div>

In your example you’re using $post->ID to get the post id but this will not work because the $post variable it’s not defined in td_module_11. The variable is defined in td_module class, so in order to be accessed it must be called as in the above example.

Thanks!

  • This reply was modified 10 years by Andrei L..
Post count: 2

Thank you very much! It works perfectly well!

Viewing 3 posts - 1 through 3 (of 3 total)
The forum ‘Newsmag’ is closed to new topics and replies.