12% off of LTD using this coupon: TWELVEPERCENTOFF. Promo ends on 2 Dec midnight UTC.
Published on Oct 19, 2018

How to add “Edit with Oxygen” links on the Pages list screen

Sridhar Katakam

Editing a Page in Oxygen‘s editor is currently a two-step process:

We have to first click on the Page and then click on “Edit with Oxygen” button.

The following snippet reduces it to a single click by adding “Edit with Oxygen” links that appear beneath the titles of Pages when they are hovered at Pages > All Pages.

Note: This only works for Pages that have a “Edit with Oxygen” button. In other words, if there’s a Page that is set to be rendered from a Template (example) it does not work as expected.

Step 1

a) Ensure that pretty Permalinks are enabled.

Settings > Permalinks > Post name.

b) Ensure that the Oxygen Template that applies to the Pages (whether it be a “Main” Catch-all or a “Page” that inherits from Main) has an Inner Content element.

Step 2

Install and activate Code Snippets plugin.

Step 3

Go to Snippets > Add New.

Add a new Snippet titled say, Add "Edit with Oxygen" links on the Pages list screen having the following code:

add_filter( 'page_row_actions', 'sk_edit_with_oxygen_pages', 10, 2 );
/**
 * Add "Edit with Oxygen" links that directly edits the Page in Oxygen at Pages > All Pages.
 *
 * @param array $actions An array of current row action links.
 * @param WP_Post $post The post object.
 * @return array Modified row action links.
 */
function sk_edit_with_oxygen_pages( $actions, $post ) {
  $actions['edit_with_oxygen'] = sprintf(
    '<a href="%1$s">%2$s</a>',
    esc_url( get_the_permalink() . '?ct_builder=true&ct_inner=true' ),
    'Edit with Oxygen'
  );

  return $actions;
}

Set the snippet to run only in admin.

tagschevron-leftchevron-rightchainangle-rightangle-upangle-downfolder-omagnifiercrossmenuchevron-downarrow-right