select box of latest (published) posts
-
when making a select box of the 12 latest post-titles (see above link at point 1.), I succeed to show the selected post-title on the screen (shop-page, basket and checkout), but when my customer orders the product, the selected post-item is not send by email, nor is it shown on the back-end of the woocommerce orders.
I have put following function in my function.php (12 times, from recentpost1 to recentpost12) in order to fill the selection-box :
function wpb_recentposts1() {
$args = array( ‘numberposts’ => ‘1’, ‘post_status’ => ‘publish’ );
$recent_posts = wp_get_recent_posts($args);
foreach( $recent_posts as $recent ){
$string = $recent[“post_title”];
}
return $string;
}
add_shortcode(‘recentposts1’, ‘wpb_recentposts1’);
add_filter(‘widget_text’,’do_shortcode’);as said, the selected post)title shows well on the screens
the email shows [recentpostx] with x (between 1 and 12, following the selected line), but it doesn’t show the selected post-title (what should be the content of [recentpostx]. The same [recentpostx] is shown in the backend woocommerce orders.What should I do (or add) to have also the content of [recentpostx] in my emails and backend
The page I need help with: [log in to see the link]
- The topic ‘select box of latest (published) posts’ is closed to new replies.