How to edit custom user meta information front end

I have solved it. In the redirect I changed if (count($error) == 0 ){ to if (count($error) < 1 ){ Also for any custom user meta fields added duplicated the following line and change the word ‘description’ to the name of the field create in your function file. if ( !empty( $_POST[‘description’] ) ) update_user_meta( … Read more

Uploading images on front end doesn’t generate thumbnail sizes

wp_generate_attachment_metadata generates metadata for an image attachment. It also creates a thumbnail and other intermediate sizes of the image attachment based on the sizes defined on the Settings_Media_Screen. wp_generate_attachment_metadata() is located in wp-admin/includes/image.php. /* just require image.php before wp_generate_attachment_metadata */ require_once(ABSPATH . ‘wp-admin/includes/image.php’); $attach_data = wp_generate_attachment_metadata( $attach_id, $file ); hope that helps!

Loop first six posts in carousel, next eight in grid

Use WP_Query with offset like this <?php $offset = 6; $post_args = array( ‘post_type’ => ‘post’, ‘posts_per_page’ => $offset, ); $slider_blog_posts = new WP_Query( $post_args ); ?> <?php if ( $slider_blog_posts->have_posts() ): ?> <div class=”carousel”> <?php while( $slider_blog_posts->have_posts() ): $slider_blog_posts->the_post(); ?> <?php get_carousel_slide( get_the_ID, true); ?> <?php endwhile; ?> </div> <?php endif; ?> <?php wp_reset_postdata(); … Read more

How to make the front-end RTL without changing the admin panel language?

Set your WordPress to a RTL language, then use the following code in functions.php or as the plugin: <?php add_filter( ‘locale’, ‘my_set_admin_locale’ ); function my_set_admin_locale( $locale ) { // check if you are in the Admin area if( is_admin() ) { // set LTR locale $locale=”en_US”; } return( $locale ); } Or otherwise, set WordPress … Read more

wp_set_object_terms() not adding new term to custom post and custom taxonomy

Use the fourth parameter in wp_set_object_terms() and pass true. wp_set_object_terms( $pid, $name, ‘name’, true); wp_set_object_terms( $pid, $email, ’email’, true); wp_set_object_terms( $pid, $birthdate, ‘dob’, true); Though I do find it weird to use taxonomies for name, email and birthdate. I’d recommend to use metadata for this. See: https://codex.wordpress.org/Function_Reference/update_post_meta Taxonomies are meant for categories and tags like … Read more

upload featured image in custom post type from frontend

You are using the wp_insert_attachment() function, which states the following in the Codex: This function is part of the low-level API used by WordPress for handling attachments. To perform the entire attachment upload and insertion process at once, you will want to use media_handle_upload() instead in most cases. So to automatically generate the image resizes … Read more

How do I create a way for users to assign categories to a post from the frontend of the website?

just remove this line update_term_cache($affected_terms); and it works perfectly <?php /* Plugin Name: WPSE Crowded Cats Plugin URI: http://wordpress.stackexchange.com/questions/43419/how-do-i-create-a-way-for-users-to-assign-categories-to-a-post-from-the-frontend Description: Allow visitors to change categories of posts. Ready to use with custom taxonomies and post types. Version: 0.1 Author: WPSE Author URI: http://wordpress.stackexchange.com/users/2110/maugly License: GPL2 */ add_action(‘plugins_loaded’,’wpse_init_crowd_cats_class’); function wpse_init_crowd_cats_class(){ new WPSECrowdCatsClass(); } class WPSECrowdCatsClass { … Read more