• Meta Box

    add_action(‘init’, ‘surgeon_register’); function surgeon_register() { $labels = array( ‘name’ => _x(‘Surgeon’, ‘post type general name’), ‘singular_name’ => _x(‘Surgeon Item’, ‘post type singular name’), ‘add_new’ => _x(‘Add New’, ‘Surgeon item’), ‘add_new_item’ => __(‘Add New Surgeon Item’), ‘edit_item’ => __(‘Edit Surgeon Item’), ‘new_item’ => __(‘New Surgeon Item’), ‘view_item’ => __(‘View Surgeon Item’), ‘search_items’ => __(‘Search Surgeon’), ‘not_found’… Continue reading

  • WordPress Ajax

    gallery.php <?php ob_start(); session_start(); /** * Template Name: Gallery * */ get_header(); ?> <?php GLOBAL $wpdb; if($_POST[‘action’] == “already”) { $alreadyReg = $wpdb->get_results(‘select id from wp_gallery_user where email=”‘.$_POST[’email’].’”‘); if(empty($alreadyReg)) { ?> alert(“please register first.”); <?php }else { $_SESSION[‘id’] = $alreadyReg[0]->id; } } if($_POST[‘action’] == “save”) { $alreadyReg = $wpdb->get_results(‘select id from wp_gallery_user where email=”‘.$_POST[’email’].’”‘); if(empty($alreadyReg))… Continue reading

  • Add Category in custom post type from front end

    wp_set_post_terms($post_id,$study,’category’,true); Continue reading

  • Woocommerce multiple category’s product display on one page

    Some time we want one or two woocommerce category’s product display in one page, I use this code. $args = array( ‘post_type’ => ‘product’, ‘posts_per_page’ => -1,’product_cat’ => ‘study,teaching’,  ‘orderby’ => ‘desc’ ); Continue reading

  • Add Custom css in wordpress

    Some time we want customization on plugin css, but it is effected on functionality, so we want minor css change in function.php as like beloved function. add_action(‘admin_head’, ‘my_study_style’); function my_study_style() { echo ‘<style> .study-link  a { display:none; } </style>’; } Continue reading

  • Image path on attachment

    Some time,specially custom post type we want image src path instead of thumbnail.So this code may helpful us. <?php $mystudy= wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), ‘thumbnail_size’ ); $mystudyurl = $mystudy[‘0’]; ?> Continue reading

  • Custom Post plugin

    <?php /* * Plugin Name: Custom Post * Plugin URI: * Description: Plugin for Custom post use [micro] as a short code. * Version: 1.0 * Author: * License: GNU General Public License */ add_action(‘init’, ‘micro_register’); function micro_register() { $labels = array( ‘name’ => _x(‘Micros’, ‘post type general name’), ‘singular_name’ => _x(‘Micro’, ‘post type singular… Continue reading

  • Simple Plugin For wordpress

    <?php /* * Plugin Name: Featured Story * Plugin URI: * Description: Plugin for Featured Story * Version: 1.0 * Author: * License: GNU General Public License */ global $wpdb; $siteurl = get_option(‘siteurl’); define(‘FS_FOLDER’, dirname(plugin_basename(__FILE__))); define(‘FS_URL’, $siteurl.’/wp-content/plugins/’ . FC_FOLDER); define(‘FS_FILE_PATH’, dirname(__FILE__)); define(‘FS_DIR_NAME’, basename(FC_FILE_PATH)); function FS_admin_menu() { $page = add_menu_page( “FS”, “Featured Story”, 8, __FILE__, “FS_admin_menu_list”,… Continue reading

  • Add Custom columns in custom post type

    add_action(“manage_posts_custom_column”,  “tank_custom_columns”); add_filter(“manage_edit-tank_columns”, “tank_edit_columns”); function tank_edit_columns($columns){ $columns = array( “cb” => “<input type=’checkbox’ />”, “title” => “Title”, “description” => “Description”, “category” => “Category”, “date” => “Date”, ); return $columns; } function tank_custom_columns($column){ global $post; switch ($column) { case “description”: the_excerpt(); break; case “category”: echo get_the_term_list($post->ID, ‘cat_tank’, ” , ‘,’ , ”); break; case “date”: //  … Continue reading

  • WordPress Custom Post Type with Taxonomy

    This is code for create custom post type in wordpress which write in function.php.In our code post-type=tank and taxonomy=study_tank. add_action(‘init’, ‘tank_register’); function tank_register() { $labels = array( ‘name’ => _x(‘My Study’, ‘post type general name’), ‘singular_name’ => _x(‘My Study Item’, ‘post type singular name’), ‘add_new’ => _x(‘Add New’, ‘My Study item’), ‘add_new_item’ => __(‘Add New… Continue reading

Design a site like this with WordPress.com
Get started