add_shortcode('form_csv', 'form_csv'); function form_csv(){ if(isset($_POST["Import"])){ $filename=$_FILES["file"]["tmp_name"]; if($_FILES["file"]["size"] > 0) { $file = fopen($filename, "r"); while (($getData = fgetcsv($file, 1000, ",")) !== FALSE) { //echo '<pre>'; //print_r($getData); //echo $getData[0].' '.$getData[1].' '.$getData[2].' '.$getData[6]; //echo "<br>"; // exit; $id = wp_insert_post(array( 'post_status' => 'publish', 'post_type'=>'career_libraries', 'post_title'=>$getData[1], 'post_content'=>$getData[2], )); wp_set_object_terms($id, $getData[6], 'alphabet_cat', true); update_field('field_61dbcf1a3ef7d',$getData[3],$id); //Median Pay update_field('field_61dbcf3b3ef7e',$getData[4],$id); // Entry... Continue Reading →
How to add add_meta_box to specific Page Template?
global $post; if ( 'template-page.php' == get_post_meta( $post->ID, '_wp_page_template', true ) ) { // The current page has the foobar template assigned // do something add_meta_box( $args ); }
Query Monitor is the developer tools panel for WordPress.
Debug Bar Query Monitor Query Monitor is the developer tools panel for WordPress. It enables debugging of database queries, PHP errors, hooks and actions, block editor blocks, enqueued scripts and stylesheets, HTTP API calls, and more.
How to use contact form core php with jquery ajax
HTML Form <!-- .isrequired.error{border-color:red;} .alert{background:#f3f3f3 none repeat scroll 0 0;border:1px solid;border-radius:3px;margin-bottom:10px;padding:10px;} .alert{display:none;} .alert.alert-danger{color:red;} .alert.alert-success{color:green;} --> File: frontend-ajax.js jQuery(document).ready(function() { jQuery(".submit_contact_btn").click(function() { //on focus jQuery("#contact_form .isrequired, #contact_form .isrequired").focus(function(){ jQuery(this).removeClass('error'); }); //on blur jQuery("#contact_form .isrequired, #contact_form .isrequired").blur(function() { if(jQuery(this).val().trim() == '') { jQuery(this).addClass('error'); } else { jQuery(this).removeClass('error'); } }); if(jQuery("#firstname").val().trim() == '' || jQuery("#lastname").val().trim() == '' ||... Continue Reading →
Add Custom Logo in WordPress Admin Login Page
If you want to display a custom logo instead of default WordPress logo in wp-admin login page, you need to add following code into functions.php /*** Change Logo In Admin Login Page With URL And Title ***/ add_action('login_head', 'admin_login_logo'); function admin_login_logo() { $logoImage = get_theme_mod( 'custom_logo' ); $logoUrl = wp_get_attachment_image_src( $logoImage , 'full' ); echo... Continue Reading →
Custom Form with Ajax
Custom from with ajax
Add page number to Yoast meta description and page titles/descriptions to avoid duplication
if ( ! function_exists( 'ujp_add_page_number' ) ) { function ujp_add_page_number( $s ) { global $page; $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1; ! empty ( $page ) && 1 1 && $s .= ' - ' . sprintf( __( 'Page %s' ), $paged ); return $s; } add_filter( 'wpseo_metadesc', 'ujp_add_page_number', 100,... Continue Reading →
custom fields without using plugins?
Custom Field
Get specify category + Jquery + Ajax
Template file foreach ( $terms as $term ) : ?> echo '';endif; ?> jQuery(document).ready(function() { /* * Trigger window resize function in javascript */ function ESresize(){ if (typeof (Event) === 'function') { // modern browsers window.dispatchEvent(new Event('resize')); } else { //This will be executed on old browsers and especially IE var resizeEvent = window.document.createEvent('UIEvents'); resizeEvent.initUIEvent('resize',... Continue Reading →