This content originally appeared on @mdo and was authored by Mark Otto
WordPress’s conditional tags are pretty freaking awesome. They came to my rescue when I wanted to add a quick “new post” link to my blog pages for when I’m logged in (which is nearly all the time). Here’s a quick block of code to help you do the same:
<?php if (is_user_logged_in()) { ?>
<a href="/wp-admin/post-new.php" id="newPost">+</a>
<?php } ?>
That’s all you need on the PHP side; just add it to the end of your footer.php right before the wp_footer()
. To style it, here’s a quick bit of CSS:
a#newPost {
position: fixed;
top: 0;
right: 40px;
background: rgba(0,0,0,.25);
.borderBottomRadius(3px);
font-size: 40px;
font-weight: bolder;
line-height: 1;
color: #fff;
text-shadow: 0 1px 0 rgba(0,0,0,.25);
padding: 5px 15px 10px;
}
And that’s it—enjoy!
This content originally appeared on @mdo and was authored by Mark Otto

Mark Otto | Sciencx (2010-10-03T00:00:00+00:00) Add a quick post link to your WordPress blog. Retrieved from https://www.scien.cx/2010/10/03/add-a-quick-post-link-to-your-wordpress-blog/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.