Creating theme edit link

I’m am creating my own base themes to use with your plugin. I’m finding that I have to take multiple steps to edit different pages. The steps include entering the wp-admin url, find the page, choosing the page builder, editing the page, being returned to the front page and starting all over again for the next page. I’ve looked through your site and don’t find much documentation on creating themes for your plugin. I’m wondering if there is a php function that can be included in the page template I create that provides an edit link if a specific user type is logged in that is able to edit? I would like to be able to initiate page editing from the page rather than from the backend.

Hey Ed! Thanks for reaching out with your questions. Have you noticed the page builder link in the WordPress admin bar? You can access the builder from the frontend using that link.

You can use the GET variable &fl_builder to launch the page builder. So, you could create a custom link that way if you wanted. You’ll want to check the users role and then create the link if they have sufficient permission. Something like this should get you started:

<?php
  	if ( current_user_can('edit_posts') ) {
    		echo '<a href="?fl_builder">Page Builder</a>';
	  }
?>

That code snippet uses the default permission for Beaver Builder (edit_posts). Also, it doesn’t check if there’s already a GET variable on the URL. You might need to harden that snippet up depending on the permalink settings.

Fantastic! Thank you. I didn’t notice the admin bar link because I disable the admin bar. However I did create the following based on your suggestion.

I put this in the header.php right after the body tag:

			<?php
			$cur_uri = strtok($_SERVER["REQUEST_URI"],'?');
		  	if ( current_user_can('edit_posts') ) {
		    		echo '<div class="fl-edit-button"><a href="'.$cur_uri.'?fl_builder">Page Builder</a></div>';
			}
			?>

and added the following to my style.css stylesheet:

.fl-edit-button {
	position: fixed;
	top: 0;
	left: 50px;
	z-index: 9999;
}

.fl-edit-button a {
	background: #fc8e08;
	color: #fff;
	padding: 8px 12px;
	font-size: 18px;
	line-height: 28px;
}

.fl-edit-button a:hover {
	background: #fcb408;
}

Perfect! Glad I could help. Let me know if you have any other questions!