Thursday, May 10, 2012

Insert data in wordpress table

$wpdb->insert('wp_profile_visitor', array(
            'profile_id' => $final_curauth->ID,
            'visitor_id' => $final_current_user->ID,
            'visitor_name' => $final_current_user->display_name,
            'visitor_nicename' => $final_current_user->user_nicename,           
            ) );
"wp_profile_visitor" is table name
"profile_id" is table field name and $final_curauth->ID is dynamic data..

You can also insert in  another format. I have given a example please see  http://h20bikash.blogspot.com/2012/05/inserting-into-data-in-wordpress.html


Sunday, May 6, 2012

Inserting Into Data in WordPress database

To perform an insert, we can use the insert method: 
 $wpdb->$wpdb->insert( $table, $data, $format ); ?> 
 Insert a row into a table.
$wpdb->insert(
'rz_tblsubmit',
array(
'id' => '',
'titleofevent' => $_POST["title"],
'typeofevent' => $_POST["type"],
'organisation' => $_POST["organisation"],
'website' => $_POST["website"],
'description' => $_POST["description"],
'startdate' => $_POST["start_date"]."-".$_POST["start_time"],
'enddate' => $_POST["end_date"],
'entryprice' => $_POST["entry_price"],
'venueaddress' => $_POST["venue_address"],
'venuecountry' => $_POST["venue_country"],
'postcode' => $_POST["venue_postcode"],
'venuewebsite' => $_POST["venue_website"],
'contact' => $_POST["contact"],
'contactemail' => $_POST["contact_email"],
'contactphone' => $_POST["contact_phone"],
'wessage' => $_POST["message"],

),
array(
'',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%d',
'%s',
'%s',
'%s',
'%d',
'%s'

)
); ?>

Saturday, May 5, 2012

wordpress upload http error...!!!

function push_the_max(){
@ini_set( 'upload_max_size' , '100M' );
@ini_set( 'post_max_size', '105M');
@ini_set( 'max_execution_time', '300' );
}
add_action('init','push_the_max');

Wednesday, February 22, 2012

How to Exclude Pages from WordPress Search Results

function SearchFilter($query) { 
 if ($query->is_search) { 
 $query->set('post_type', 'post'); 
 }  return $query; 
 }  
  add_filter('pre_get_posts','SearchFilter');

Thursday, January 26, 2012

wp mail content type

<?php

add_filter('wp_mail_content_type','set_content_type');

function set_content_type($content_type){

return 'text/html';

}

?>

Thursday, October 20, 2011

get_sidebar

<?php get_sidebar('left'); ?>

<?php get_sidebar('right'); ?>

<?php get_sidebar(); ?>

Wednesday, September 14, 2011

change default wordpress message

function example_remove_dashboard_widgets() {
    // Globalize the metaboxes array, this holds all the widgets for wp-admin
     global $wp_meta_boxes;

    // Remove the incomming links widget
    unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);   
//$wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']
    // Remove right now
    unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
    unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']);
    //unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
    unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);
    unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);
}

// Hoook into the 'wp_dashboard_setup' action to register our function
add_action('wp_dashboard_setup', 'example_remove_dashboard_widgets' );


if ( !current_user_can( 'edit_users' ) ) {
  add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_version_check' );" ), 2 );
  add_filter( 'pre_option_update_core', create_function( '$a', "return null;" ) );
}

add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_version_check' );" ), 2 );
add_filter( 'pre_option_update_core', create_function( '$a', "return null;" ) );

remove_action( 'wp_version_check', 'wp_version_check' );
remove_action( 'admin_init', '_maybe_update_core' );
add_filter( 'pre_transient_update_core', create_function( '$a', "return null;" ) );
add_filter( 'pre_site_transient_update_core', create_function( '$a', "return null;" ) );