Add post class in custom loop (WP_QUERY)

As milo stated, I need to use the post_class function to use the post_class filter. By adding <?php post_class(); ?> to the div in my loop I was then able to successfully modify the post class. Below is my full code containing the post_class filter and the post_class function. Reference: https://codex.wordpress.org/Function_Reference/post_class <?php //Call in the … Read more

Adding my own custom template page but got white page

I think it would be best to do a template override in Woocommerce. If by single you mean a page when viewing only one product then look at the single-product.php template. The directory it needs to located is: /public_html/wp-content/themes/your-theme/woocommerce/single-product.php. You can download the template overrides from woothemes.

ACF Images If/else

If I understand your question correctly, I believe this is what you’re looking for: <div class=”postthumbnail”> <?php $usercrop = get_field(‘usercrop’); if ($usercrop) { $image = wp_get_attachment_image_src(get_field(‘usercrop’), ‘full’); ?> <img class=”post-thumbnail img-responsive postpic” src=”https://wordpress.stackexchange.com/questions/232716/<?php echo $image[0]; ?>” alt=”<?php echo get_the_title(get_field(‘usercrop’)) ?>” /> <?php } ?> </div> It checks the field and only displays the HTML if … Read more

Edit Post custom options not working

You need the $post_id passed in to the function you are calling from the hook. Try making your function declaration like this: function slider_data( $post_id )

Div Missing In Custom Loop Query

You have this code: elseif (17 < $count && $count <= 27 && $paged === 1) : if ($count === 10) echo ‘DIV/CONTENT BEFORE THE NEXT 10 POST GOES HERE’; The first conditional fails when 10 === $count and so the second conditional can never succeed. As your while loop executes (in a structure that … Read more

searching for members in wordpress

Probably this plugin is using user_meta table. Your query should looks like this: $args = array( ‘meta_key’ => $_searchedWhat, ‘meta_value’ => $_searchedFor ); $users = get_users($args); For more informations look into documentation: get_users EDIT: Unfortunately, that plugin is storing all data into one field, so you cannot query users by single field. You should use … Read more