Posts

Showing posts from April, 2015

How to change Email To address dynamically in contact form 7 based on form data in wordpress

while user submit contact form using contact form 7 , you need to get submitted data to change to address depend on submitted data. For get submitted data you need below hook add_action("wpcf7_before_send_mail", "wpcf7_do_something"); by this hook you can get submitted data function wpcf7_do_something ($WPCF7_ContactForm) {  $submission = WPCF7_Submission::get_instance();  $data =&$submission->get_posted_data();  // $data variable is array of data // do something as you need } Also you need one filter hook for change to address below filter hook is used for change mail components add_filter( 'wpcf7_mail_components', 'mycustom_wpcf7_mail_components' ); function mycustom_wpcf7_mail_components($components){        // do somthing here and return $components     return $components; }

How to Create a custom widget for wordpress sidebar

How to create a custom widget for your theme or custom plugin , just copy and paste below code and paste it into your theme's functions.php or your custom plugin file class showtable_widget extends WP_Widget { function __construct() {     global $wpdb; parent::__construct( 'showtable_widget',   // custom widget slug put slug whatever you like __('Show xml feed table', 'showtable_widget'),   // widget title display in admin side widget area array( 'description' => __( 'Display feed table in sidebar ', 'showtable_widget' ), )  // description for );    // your widget purpose } public function widget( $args, $instance ) {   // this function use for display data frontend side      global $wpdb; $title = apply_filters( 'widget_title', $instance['title'] ); echo $args['before_widget']; if ( ! empty( $title ) ) echo $args['before_title'] . $title . $args['after_title']; // c...