Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
/* Add and Change Position of User Menu */ add_filter('jnews_dropdown_link', 'jeg_nav_account_menu', 1); function jeg_nav_account_menu($dropdown) { if (is_user_logged_in()) { /* If you need to get a list of roles */ // global $wp_roles; // print("
" . print_r($wp_roles->roles, true) . "
"); $roles = array('administrator', 'author', 'contributor'); /* Set Roles */ $user = wp_get_current_user(); /* Get Role User */ foreach ($roles as $role) { if (in_array($role, $user->roles)) { $temp = $dropdown; unset($dropdown); /* Set the position under this code. */ $dropdown['new_menu'] = array( /* New Menu */ 'text' => 'New Menu', 'url' => 'http://jnews.io' ); $dropdown['account'] = true; /* Set Position of My Account || If not initialized or set to false, the position will always be at the top */ $dropdown['new_menu2'] = array( /* New Menu 2 */ 'text' => 'New Menu 2', 'url' => 'http://jnews.io' ); $dropdown['logout'] = $temp['logout']; /* Set Position of logout || Don't delete this initialization, just move the position */ /* Finish adjusting the Position */ return $dropdown; } } return $dropdown; } }
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)