I have created a meta box that allows users to add an additional name/id to their post. From what I can tell it is adding the meta information correctly because when I edit a post that has a custom name/ID it shows up in the input box by default as it should.
So my issue is that I am trying to pull the custom ID/name and use it as an additional ID tag in the code. Although it is not retrieving anything. When I use the code in my theme and check the html on the page the ID is showing ID="". So for some reason it is not pulling anything. Can anyone see an issue?
<?php $post_id = get_the_ID(); ?> <?php $value = get_post_meta($post_id, 'newtheme_section_id'); ?> <id="<?php $value; ?>">
If I change get_the_ID() to the_ID() then it returns a value but it is the post ID instead of the custom id the user entered into the feild.
EDIT: I was able to figure it out by echoing the function instead of storing it in a variable, along with Mannys suggestion . Here is the updated code.
<?php $post_id = get_the_ID(); ?> <id="<?php echo esc_attr( get_post_meta($post_id, 'newtheme_section_id', true) ); ?>">