Reputation: 727
<?php $imvi = get_post_meta('312', 'bmeta_o', true); ?>
The above works fine when hardcoded Wordpress post ID is used = '312'
But the theme demands that this should come through some selection of post done in the theme customizer.
I tried various versions → $selected_post_id = echo get_theme_mod('my_setting');
1. <?php $imvi = get_post_meta(echo $selected_post_id;, 'bmeta_o',
true); ?>
2. <?php $imvi = get_post_meta(echo '', 'bmeta_o', true); ?>
3. <?php $imvi = get_post_meta($selected_post_id;, 'bmeta_o', true); ?>
But none of them worked.
$selected_post_id = echo get_theme_mod('my_setting');
→ This has
some flaw and it is not pulling the WordPress post ID correctlyPlease let me Know if you need any other information.
Upvotes: 0
Views: 31
Reputation: 4228
echo
inside the call function and ;
, both of which will cause syntax error. echo
and just empty string. Will not work. ;
will still cause an error.$selected_post_id
actually contains post ID)$imvi = get_post_meta($selected_post_id, 'bmeta_o', true);
Upvotes: 1