Skip to content

Instantly share code, notes, and snippets.

View ridhamdholakia's full-sized avatar

Ridham Dholakia ridhamdholakia

  • Junagadh,Gujarat,India
View GitHub Profile
@ridhamdholakia
ridhamdholakia / Search Dynamically From MySQL Database With Dynamic Column Name
Last active November 28, 2019 11:06
Search Dynamically From MySQL Database With Dynamic Column Name
/************************************* Jqueey For Input On Keyup *******************************************/
$('body').on('keyup','#search-query',function(e){
var keyword = $(this).val();
var tablename = $('#table-name').val();
var allColumns = {};
$('.filter-select').each(function () {
if($(this).val() != ''){
allColumns[$(this).attr('id')] = $(this).val();
}
});
/*==================================================== Add New User Roles ======================================== */
add_role( 'author', __( 'Author' ),
array(
'read' => false,
'edit_posts' => false,
'edit_pages' => false,
'edit_others_posts' => false,
'create_posts' => false,
'manage_categories' => false,
add_action( 'admin_menu', 'add_subscribed_user_list' );
function add_subscribed_user_list()
{
add_menu_page(
'Subscribed Users',
'Subscribed Users',
'manage_options',
'user-list',
'add_subscribed_users_list',
/*============================= Custom Meta Box (Assign Articles) To Custom Post Type ============================ */
function assign_article_metabox() {
$post_types = array( 'your-post-type' ); // you can use multiple post types here(array of post types)
foreach ( $post_types as $post_type ) {
add_meta_box(
'member_sectionid',
__( 'Name Of Metabox', 'member_textdomain' ),
'assign_article_metafields',
/*========= Extra Field Function ======== */
function extra_profile_fields( $user ) {
$user_meta = get_userdata($user->ID);
$user_roles = $user_meta->roles;
$role = $user_roles[0];
$contactnumber = get_the_author_meta( 'contactnumber', $user->ID );
$city = get_the_author_meta( 'city', $user->ID );
$pincode = get_the_author_meta( 'pincode', $user->ID );
$state = get_the_author_meta( 'state', $user->ID );
function job_applicants(){
$labels = array(
'view_item' => __( 'View Applicant', 'text_domain' ),
'add_new_item' => __( 'Add New Applicant', 'text_domain' ),
'add_new' => __( 'Add New Applicant', 'text_domain' ),
'edit_item' => __( 'Edit Applicant', 'text_domain' ),
'update_item' => __( 'Update Applicant', 'text_domain' ),
'search_items' => __( 'Search Applicant', 'text_domain' ),
'not_found' => __( 'Not found', 'text_domain' ),
'not_found_in_trash' => __( 'Not found in Trash', 'text_domain' ),
@ridhamdholakia
ridhamdholakia / Custom Post with Taxonomy - Wordpress
Created April 16, 2018 06:18
Wordpress Custom Post with Custom Taxonomy
/* ======================================== Custom Post ============================================= */
function education_post() {
$labels = array(
'name' => _x( 'Education Blogs', 'Post Type General Name', 'text_domain' ),
'singular_name' => _x( 'Education Blog', 'Post Type Singular Name', 'text_domain' ),
'menu_name' => __( 'Education Blogs', 'text_domain' ),
'parent_item_colon' => __( 'Parent Education Blog:', 'text_domain' ),
'all_items' => __( 'All Education Blogs', 'text_domain' ),
'view_item' => __( 'View Education Blog', 'text_domain' ),
function all_woocommerce_cart_expire_timeout(){
global $prod_ids;
global $product_timeout;
function action_woocommerce_add_to_cart( $array, $int, $int ) {
function perform_task() {
$start_time = time();
return $start_time;
}
function sidebar_accordian_left()
{
global $post;
$categories = get_terms( 'education_categories', array(
'hide_empty' => false,
) );
echo '<ul class="accordian-menu" id="toggle-view">';
foreach( $categories as $category ) {
$cat_id = $category->term_id;