[![在此处输入图片描述] [1]] [1]我向我的functions.php添加了一些类,如下所示:
add_action('admin_menu',
'wpso_custom_links_admin_menu');
function wpso_custom_links_admin_menu() {
global $submenu;
$submenu['index.php'][] = array('Link One', 'read',
'https://www.example.com/', '', 'jobs-dashboard');
$submenu['index.php'][] = array('Link Two', 'read',
'https://asdf.com/', '', 'events-dashboard
');
}
然后我添加了CSS:
. jobs-dashboard {background-color: green;}
没用。为什么不?
答案 0 :(得分:0)
您似乎正在使用主题的附加CSS选项,通常用于前端CSS更改。
要将CSS添加到管理区域,可以使用functions.php中的admin_head
钩子。
add_action('admin_head', 'my_custom_css');
function my_custom_css() {
echo '<style>
.jobs-dashboard {background-color: green;}
</style>';
}
答案 1 :(得分:0)
我认为这是行不通的,因为您在课堂上放了一个空格:
const bcrypt = require("bcryptjs");
const User = require("../models/user");
function getErrorMessage(req) {
let message = req.flash("error");
if (message.length > 0) {
message = message[0];
} else {
message = null;
}
return message;
}
exports.getLoginPage = (req, res) => {
res.render("blog/login", {
pageTitle: "login",
path: "/login",
errorMessage: getErrorMessage(req)
});
}
exports.getsignUpPage = (req, res) => {
res.render("blog/signup", {
pageTitle: "signup",
path: "/signup",
errorMessage: getErrorMessage(req)
});
}
exports.postLogin = (req, res, next) => {
const {
username,
password
} = req.body;
User.findOne({username})
.then(user => {
bcrypt
.compare(password, user.password)
.then(doMatch => {
if (doMatch) {
req.session.isLoggedIn = true;
req.session.user = user;
return req.session.save(err => {
console.log(err);
res.redirect("/");
});
}
})
.catch(err => {
console.log(err);
req.flash("error", "invalid email or password.");
res.redirect("/login");
})
})
.catch(err => {
console.log(err);
req.flash("error", "Invalid email or password.");
return res.redirect("/login");
});
}
exports.postLogout = (req, res, next) => {
req.session.destroy(err => {
console.log(err);
res.redirect("/");
})
}
exports.postSignup = (req, res, next) => {
const {
username,
password
} = req.body;
User.findOne({username})
.then(user => {
if (user === null) {
throw "";
} else {
req.flash("error", "email exists already, please pick a different one.");
return res.redirect("/signup")
}
})
.catch(() => {
return bcrypt
.hash(password, 12)
.then(hashedPassword => {
const user = new User({
username: username,
password: hashedPassword
});
return user.save();
})
.then(result => {
res.redirect("/login");
})
.catch(err => {
console.log(err);
})
})
}```