Skip to content

Instantly share code, notes, and snippets.

Ridham Dholakia ridhamdholakia

Block or report user

Report or block ridhamdholakia

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ridhamdholakia
ridhamdholakia / Search Dynamically From MySQL Database With Dynamic Column Name
Last active Nov 28, 2019
Search Dynamically From MySQL Database With Dynamic Column Name
View 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();
}
});
View Add new userrole to wordpress admin
/*==================================================== 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,
View Create Admin Menu In Wordpress Admin
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',
View Add Custom metabox(custom fields programatically) to Custom Post Types
/*============================= 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',
View Add Extra Fields In Users Tab in Wordpress Admin
/*========= 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 );
View Custom Post type inside custom post type
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 Apr 16, 2018
Wordpress Custom Post with Custom Taxonomy
View Custom Post with Taxonomy - Wordpress
/* ======================================== 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' ),
View Cart Timeout - Delete Product from Cart After SomeTime
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;
}
View Custom Accordian Menu With Categories
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;
You can’t perform that action at this time.