Wrapping result of the_terms in a span with a class of the term name

Generally speaking in the WordPress world, functions prefixed with the_ will output results immediately. Functions prefixed with get_ will return the results without outputting them. The function get_the_terms() can be used to achieve the desired results. Here’s a complete function that’s essentially a wrapper for get_the_terms() with a little bit of extra formatting: /** * … Read more

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

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