Skip to content

Commit

Permalink
refactor: use a dedicated upsell page for Custom Layouts
Browse files Browse the repository at this point in the history
  • Loading branch information
Soare-Robert-Daniel committed Jan 17, 2025
1 parent e73862e commit 5a33f9b
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
3 changes: 2 additions & 1 deletion inc/admin/dashboard/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,8 @@ private function get_external_plugins_data() {
*/
public function render_custom_layout_header() {
$screen = get_current_screen();
if ( ! $screen || $screen->id !== 'edit-neve_custom_layouts' ) {

if ( ! $screen || ! ( $screen->id === 'edit-neve_custom_layouts' || $screen->id === 'neve_page_neve-custom-layout-upsell' ) ) {
return;
}

Expand Down
47 changes: 46 additions & 1 deletion inc/admin/hooks_upsells.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@ public function register_custom_layout_upsell_page( $theme_page, $capability ) {
__( 'Custom Layouts', 'neve' ),
__( 'Custom Layouts', 'neve' ),
$capability,
'edit.php?post_type=neve_custom_layouts' // TODO: make a dummy page.
'neve-custom-layout-upsell',
array( $this, 'render_custom_layout_page' )
);
}

Expand Down Expand Up @@ -457,4 +458,48 @@ public function render_custom_layouts_upsell_modal() {
</div>
<?php
}

/**
* Renders the the upsell page for Custom Layouts.
*
* @return void
*/
public function render_custom_layout_page() {
?>
<div class="wrap">
<div class="wp-list-table">
<table class="widefat posts">
<thead>
<tr>
<th scope="col" class="manage-column column-title column-primary"><?php echo esc_html__( 'Title', 'neve' ); ?></th>
<th scope="col" class="manage-column"><?php echo esc_html__( 'Type', 'neve' ); ?></th>
<th scope="col" class="manage-column"><?php echo esc_html__( 'Location', 'neve' ); ?></th>
<th scope="col" class="manage-column"><?php echo esc_html__( 'Status', 'neve' ); ?></th>
<th scope="col" class="manage-column"><?php echo esc_html__( 'Date', 'neve' ); ?></th>
</tr>
</thead>
<tbody id="the-list">
<tr>
<td colspan="5" class="column-primary">
<p class="description" style="text-align: center; padding: 20px;">
<?php echo esc_html__( 'Upgrade to Neve Pro to a Custom Layout.', 'neve' ); ?>
</p>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<th scope="col" class="manage-column column-title column-primary"><?php echo esc_html__( 'Title', 'neve' ); ?></th>
<th scope="col" class="manage-column"><?php echo esc_html__( 'Type', 'neve' ); ?></th>
<th scope="col" class="manage-column"><?php echo esc_html__( 'Location', 'neve' ); ?></th>
<th scope="col" class="manage-column"><?php echo esc_html__( 'Status', 'neve' ); ?></th>
<th scope="col" class="manage-column"><?php echo esc_html__( 'Date', 'neve' ); ?></th>
</tr>
</tfoot>
</table>
</div>
<?php $this->render_custom_layouts_upsell_modal(); ?>
</div>
<?php
}
}

0 comments on commit 5a33f9b

Please sign in to comment.