Added delete feature to post importer
This commit is contained in:
@ -307,7 +307,22 @@ function render_lcp_theme_settings_page() {
|
||||
<h2>Miscellaneous Settings</h2>
|
||||
|
||||
<!-- Button to trigger the AJAX import demo posts -->
|
||||
<button id="import-demo-posts" class="button button-primary">Import Demo Posts</button>
|
||||
<h3> Demo Posts </h3>
|
||||
<?php
|
||||
// Get the 'lcp_demo_posts' option from the database
|
||||
$demo_posts_data = get_option('lcp_demo_posts', false);
|
||||
|
||||
// Check if the lcp_demo_posts option exists
|
||||
if ($demo_posts_data) {
|
||||
echo '<span>' . count($demo_posts_data['post_ids']) . ' Demo posts have been imported.</span>';
|
||||
// If demo posts have been imported, display the "Delete Demo Posts" button (this can be disabled or hidden based on your logic)
|
||||
echo '<button class="lcp" id="delete-demo-posts" class="button">Delete Demo Posts</button>';
|
||||
} else {
|
||||
// If demo posts have NOT been imported, display the "Import Demo Posts" button
|
||||
echo '<button class="lcp" id="import-demo-posts" class="button button-primary" >Import Demo Posts</button>';
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -330,23 +345,4 @@ function highlight_to_share_popup() {
|
||||
";
|
||||
}
|
||||
|
||||
/* HOOKS */
|
||||
//Move to custom hooks class or file in future
|
||||
function lcp_wp_head_hooks(){
|
||||
// Define lcp_theme_settings array from wp_options
|
||||
$options = get_option('lcp_theme_settings', array());
|
||||
// Echo highlight-to-share markup and enqueue javascript
|
||||
// Highlight-to-share css is already in style.css
|
||||
if ( isset($options['enable_highlight_to_share']) && $options['enable_highlight_to_share'] ) {
|
||||
highlight_to_share_popup();
|
||||
wp_enqueue_script( 'lcp-highlight-to-share', get_template_directory_uri() . '/assets/js/highlight-to-share.js', array(), null, true );
|
||||
}
|
||||
}
|
||||
|
||||
add_action('wp_head', 'lcp_wp_head_hooks');
|
||||
|
||||
|
||||
|
||||
|
||||
/* ICONS */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user