Help creating shortcode that queries custom field checkbox
-
Hi
I am trying to create a shortcode for this page which show an authors user photo and name only if a custom field checkbox on the user profile page is selected. At the moment it is show all the authors – regardless of whether the box is checked or not.
Here is my shortcode code:
//Add steering member list shortcode function steering_list_authors() { if (get_the_author_meta( "steering", $user->ID)) { $authors = get_users(array( 'orderby' => 'display_name', 'count_totals' => false, 'who' => 'authors' )); $list = ''; if($authors) : $list .= '<div id="mason2">'; foreach($authors as $author) : $list .= '<div class="author-entry">'; $archive_url = get_author_posts_url($author->ID); $list .= '<a href="'. $archive_url . '" title="' . __('View ') . $author->display_name . '">'; $list .= get_avatar($author->user_email); $list .= '<a>'; $list .= '<a href="'. $archive_url . '" title="' . __('View ') . $author->display_name . '"><h3>' . $author->display_name . '</h3></a>'; $list .= '</div>'; endforeach; $list .= '</div>'; endif; return $list; }} add_shortcode('steering_list', 'steering_list_authors');
I can’t work out what I need to change to make it dependent on the checkbox. I would be very grateful for any help.
Thanks
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Help creating shortcode that queries custom field checkbox’ is closed to new replies.