Echo Option Value Based On WordPress User Role

Something like this? if(current_user_can(‘administrator’)){ echo ‘<option value=”[email protected]”>[email protected]</option>’; }elseif(current_user_can(‘subscriber’)){ echo ‘<option value=”[email protected]”>[email protected]</option>’; } Maybe this should be wrapped in a user logged in check like this: if(is_user_logged_in()){ if(current_user_can(‘administrator’)){ echo ‘<option value=”[email protected]”>[email protected]</option>’; }elseif(current_user_can(‘subscriber’)){ echo ‘<option value=”[email protected]”>[email protected]</option>’; } }

Menu selection for header

One way of doing this would be to set a cookie when the user selects which menu they want to view, and on all page visits, check the cookie to see which menu they chose, and display the menu that matches their selection. A cookie can be set using JavaScript on the client side, while … Read more

put a list of one post type in other post type to select from it and display selected item in second post type’s single page

I cannot create a complete solution here, because it’s kinda a ‘work for me for free’ question. I can (globally) tell you how to accomplish this. wp-admin –> courses CPT –> add a metabox ‘select teacher(s)’. Collect the teachers with get_posts(). Save the selected teachers as meta, use update_post_meta($course_post_id, ‘assigned_teachers’, $assigned_teachers) in metabox save function. … Read more

Nested select statements not working

You need to identify the tables for each of the columns that have the same name. You should also be using an IN statement and not = for the department. I can’t test this since I don’t have your DB but you can try this: $sql = $wpdb->get_results(“SELECT * FROM ” . $wpdb->prefix . “dir_personnel … Read more

How to set different color in a select box due to selection with css

You can achieve this by adding an onchange event to your select tag. Try the code below: HTML: <select id=”derselect” onchange=”this.className=this.options[this.selectedIndex].className” class=”green”>   <option class=”green”>Test 1   <option class=”red”>Test 2 </select> And your CSS: .green { color:green} .red {color:red} 🙂

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