Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

So I have my admin bar hidden by default, because it's ugly, instead of writing a bunch of if statements so certain elements to the WP-admin panel only appear for logged in users, so far so good.

The one I'm having trouble with is the 'all posts' screen, the url is wp-admin/edit.php, yet that gives me a 404 error.

This works, takes the user to the new post screen.

<?php 
            global $user_login;
            get_currentuserinfo(); 
            if ($user_login) :
            ?>
            <div class="sectionblocktwo">
                <div class="writeurl">

                    <a href="/wp-admin/post-new.php">Write</a>

                </div> <!-- end div loginurl -->

            </div><!-- end div sectionblocktwo -->

        <?php endif; ?>

This does not work. This only fails to work when on the single.php, since it's an looking for the url sitename.com/single-post-name/wp-admin/edit.php, the other links work fine on single pages.

              <?php 
        global $user_login;
        get_currentuserinfo(); 
        if ($user_login) :
    ?>
        <div class="sectionblocktwo">
            <div class="loginurl">

                <a href="wp-admin/edit.php">My Posts</a>

            </div> <!-- end div loginurl -->

        </div><!-- end div sectionblocktwo -->

<?php endif; ?>

Is there some php code or something I can use to link to the all posts part of the dashboard?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

Your 2nd example omits the leading / in the URL -- does /wp-admin/edit.php work?

Also, you're wiser to use admin_url(), since it's possible to change the Admin URL to something other than /wp-admin. Instead of <a href="/wp-admin/edit.php">, use <a href="<?php echo( admin_url( 'edit.php' ) ); ?>">. It's more complicated, but much safer.

share|improve this answer
    
Perfect, didn't know about admin url, thank you. –  andy Jun 20 '13 at 22:06
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.