Viewing 6 replies - 1 through 6 (of 6 total)
  • Just add a link in your theme like this(index.php for example), post creation is managed by javascript in the plugin (with .fee-new and .fee-new-post classes).

    <div class="fee-new">
         <?php if (is_user_logged_in()) {
             echo '<a href="https://yoursite/post-new.php?post_type=\'post\'">Create a new post</a>';
             }
         ?>
    </div>
    Thread Starter hkucukali

    (@hkucukali)

    Thanks
    But it returns 404 page.

    I modify it little bit, like:

    <div class="fee-new">
         <?php if (is_user_logged_in()) {
             echo '<a href="https://yoursite.com/wp-admin/post-new.php?post_type=post">Create a new post</a>';
             }
         ?>
    </div>

    But it returns, reauth page https://yoursite.com/login/?reauth=1
    What am I missing?

    Sorry, I did this a long time ago, I remember I had to modifiy plugin to do what you want. I created class fee-new-post and modified fee-adminbar.js file. The plugin accesses to the link with jQuery.

    <div class="fee-new">
     <?php if (is_user_logged_in()) {
         echo '<a class="fee-new-post" href="#">Create a new post</a>';
         }
         ?>
    </div>

    and you have to update the file fee-adminbar.js and add this code just after onclick event.

    $('.fee-new-post')
        .add( value === 'post' ? 'a[href="' + fee.postNew + '"]' : null )
        .attr( 'href', '#' )
        .on( 'click', function( event ) {
            event.preventDefault();
    	_new( value );
        } );

    This code will work but keep in mind that you will have to reinsert this js code after each plugin update.

    I thing you can delete .add and .attr lines.
    But it is strange your code does not work.

    Thread Starter hkucukali

    (@hkucukali)

    Thank you for your interest.

    Are you using this codes and that “Create a new post” link working?

    It is not working on my website yet. It just makes url: yoursite.com/#
    It also tried your solution on an other fresh website which is on different server. It is not working on there too. I want to mention that +New > Post button on adminbar works normally.

    Could you provide your index.php and fee-adminbar.js file? If you modified other files of plugin I will be happy if you send whole plugin folder. You can send me by uploading to here: https://cwok.me/u/J7Z8

    I want to do the same thing but the code above not work for me too. Any help please!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to add New Post Button anywhere but adminbar?’ is closed to new replies.