Insert wp_editor on front-end with AJAX?

So, after doing some more digging, I answered my own question by “connecting the dots”, so to speak. There’s a lot of bits and pieces of info on this topic on StackOverflow and StackExchange, but none of them really answered my question. So here is the full working code to loading a wp_editor instance with … Read more

Frontend Post – Allow Only Image File Upload

You can check mime type of uploaded image before upload to media. Add mimeTypes in $allowmimeType which you want to allow. then check uploaded files mimetype $fileMimeType. If not found in allowed mimetype then return false. // Insert Attachment function insert_attachment($file_handler, $post_id, $setthumb=’false’) { if ($_FILES[$file_handler][‘error’] !== UPLOAD_ERR_OK){ return __return_false(); } # uploaded file type … Read more

wp_enqueue_scripts hook is not being called

Your code is correct, though I would not add the callback if the function name has already been used. If someone else has used the name you don’t know what you might be adding. if(!function_exists(‘bi_frontend_scripts’)) { function bi_frontend_scripts() { wp_enqueue_script(‘jquery’); // I originally wanted to do: wp_enqueue_script(‘jQuery.bxSlider’, get_bloginfo(‘template_url’).’/scripts/jquery.bxslider/jquery.bxslider.min.js’, array(‘jquery’)); } add_action(‘wp_enqueue_scripts’, ‘bi_frontend_scripts’); } I also … Read more

Why are my frontend theme styles bleeding into the backend?

You’re supposed to enqueue on the wp_enqueue_scripts event. Placing the function in functions.php and immediately running it, will make it run on all pages, including the admin area Here’s an example from the devhub: /** * Proper way to enqueue scripts and styles. */ function wpdocs_theme_name_scripts() { wp_enqueue_style( ‘style-name’, get_stylesheet_uri() ); wp_enqueue_script( ‘script-name’, get_template_directory_uri() . … Read more

Frontend Post Form Validation

The best way to do form validation is with a combination of JavaScript and PHP. The reason why you want to perform JavaScript validation is to give the users a chance to correct their errors without submitting the form. Plus, it will stop any casual mistakes. You will also want to ensure validation on the … Read more

Uploading avatar from the frontend

You only need to of these hooks show_user_profile to show the extra fields and personal_options_update to update, try: <?php ob_start(); include_once(“../../../wp-load.php”); get_header(); /* Get user info. */ global $current_user, $wp_roles; get_currentuserinfo(); /* Load the registration file. */ require_once( ABSPATH . WPINC . ‘/registration.php’ ); /* If profile was saved, update profile. */ if ( ‘POST’ … Read more

How to attach a uploaded video to post from front end

You could use wp_insert_attachment to upload a video file into the media library and then attatch it to the newly created post. See http://codex.wordpress.org/Function_Reference/wp_insert_attachment But it would be wise to have a few conditional statements in place to at least check for video size and type otherwise your site would be open to abuse.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)