/**
  * Filters the row actions
  * @filter post_row_actions
  */
 public function post_row_actions($actions, $post)
 {
     if (in_array($post->post_type, $this->post_types) && pootlepb_uses_pb($post)) {
         $nonce_url = wp_nonce_url(get_the_permalink($post->ID), 'ppb-live-edit-nonce', 'ppbLiveEditor');
         $actions['live-edit'] = '<a href="' . $nonce_url . '" aria-label="Edit “Home”">Live Edit</a>';
     }
     return $actions;
 }
示例#2
0
/**
 * Check if we're currently viewing a panel.
 *
 * @param bool $can_edit Also check if the user can edit this page
 *
 * @return bool
 * @since 0.1.0
 */
function pootlepb_is_panel($can_edit = false, $post = false)
{
    // Check if this is a panel
    $is_panel = is_singular() && pootlepb_uses_pb($post);
    return $is_panel && (!$can_edit || current_user_can('edit_post', get_the_ID()));
}