function get_b_cf7_func() {
global $wpdb;
$table_name = $wpdb->prefix . 'sell';
$user = wp_get_current_user()->user_login;
$query = $wpdb->get_results("SELECT * FROM ".$table_name." WHERE user_name='".$user."'");
$include_var = '';
foreach ($query as $q ):
$include_var .= "<tr><td>".$q->coin."</td><td>".$q->bank."</td><td>".$q->cours."</td></tr>";
$str = "<table class='table'<thead><tr><th> Title </th><th>Content</th><th>Date</th></tr></thead><tbody>".$include_var."</tbody></table>";
endforeach;
$str_ = $str;
return $str_;
}
add_shortcode('get_b', 'get_b_cf7_func');
add_filter( 'wpcf7_form_elements', 'do_shortcode' );
function hello_world_cf7_func() {
return "Привет! Я шоркод для Contact Form 7!";
}
add_shortcode('hello_world', 'hello_world_cf7_func');
//----------------------------------------------------------------
add_filter('wpcf7_mail_components', 'do_shortcode_mail', 10, 3);
function do_shortcode_mail( $components, $contactForm, $mailComponent ){
if( isset($components['body']) ){
$components['body'] = do_shortcode($components['body']);
}
return $components;
}