Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Sarthak Nagoshe

    (@sarthaknagoshe2002)

    I can see that you have applied 160px of padding to the entire page through elementor.
    Removing that might help.

    Sarthak Nagoshe

    (@sarthaknagoshe2002)

    Hey, I spend a good time to write a code for your requirement.

    Step 1: Add JavaScript

    Add the following JavaScript to your admin area. You can enqueue it using admin_enqueue_scripts.

    jQuery(document).ready(function($) {
        $('#target').on('click', function() {
            if (confirm("Do you really want to delete prices?")) {
                $.ajax({
                    url: ajaxurl, // WordPress AJAX URL
                    type: 'POST',
                    data: {
                        action: 'reset_price_fields', // Custom action to be processed in PHP
                        author_id: $(this).data('author-id') // Pass the author ID
                    },
                    success: function(response) {
                        alert(response.message); // Show success message
                    },
                    error: function() {
                        alert('Error resetting prices.'); // Show error message
                    }
                });
            }
        });
    });

    Step 2: Add PHP Function

    Add this function to your theme’s functions.php file or a custom plugin.

    add_action('wp_ajax_reset_price_fields', 'reset_price_fields');
    
    function reset_price_fields() {
        // Check for the required parameter
        if (!isset($_POST['author_id'])) {
            wp_send_json_error(['message' => 'No author ID provided.']);
            exit;
        }
    
        $author_id = intval($_POST['author_id']);
        $args = [
            'post_type' => 'apartment', // Change this to your custom post type
            'author' => $author_id,
            'posts_per_page' => -1 // Get all posts
        ];
    
        $query = new WP_Query($args);
    
        if ($query->have_posts()) {
            while ($query->have_posts()) {
                $query->the_post();
                $post_id = get_the_ID();
    
                // Get current custom fields
                $custom_fields = get_post_meta($post_id);
    
                // Prepare an array of custom fields to reset
                $fields_to_reset = ['price_field_1', 'price_field_2']; // Replace with your custom field keys
    
                foreach ($fields_to_reset as $field) {
                    if (array_key_exists($field, $custom_fields)) {
                        // Delete the specific custom field
                        delete_post_meta($post_id, $field);
                    }
                }
            }
            wp_send_json_success(['message' => 'Prices have been reset successfully.']);
        } else {
            wp_send_json_error(['message' => 'No posts found for this author.']);
        }
    
        wp_reset_postdata();
        exit;
    }

    Step 3: HTML

    Make sure to include the data-author-id attribute in your button to pass the author’s ID.

    <button type="button" id="target" data-author-id="<?php echo get_current_user_id(); ?>">Cancella prezzi</button>

    Let me know if this works for you & if requires any further modification.

    Sarthak Nagoshe

    (@sarthaknagoshe2002)

    Fix 1 :- Look for the siteurl and home entries and ensure they are both set to https://yourdomain.com.

      Fix 2:- If you have access to your hosting control panel (like cPanel), you can edit the wp-config.php file directly from there.
      Add the following lines to force your site to use HTTP:

      define('WP_HOME', 'https://yourdomain.com'); define('WP_SITEURL', 'https://yourdomain.com');


      Sarthak Nagoshe

      (@sarthaknagoshe2002)

      some name ideas that avoid the term “plugin” while still conveying the purpose of your tool:

      1. Module Inspector
      2. Compatibility Guardian
      3. WordPress Watchdog
      4. Update Tracker
      5. Dependency Tracker
      Sarthak Nagoshe

      (@sarthaknagoshe2002)

      So, in this case you have 2 options:-

      Option 1: Update the Site URL in wp-config.php

      1. Open your site’s wp-config.php file using a text editor.
      2. Add these lines right above the line that says
        /* That's all, stop editing! Happy publishing. */
        define('WP_HOME','https://your-local-site-url'); define('WP_SITEURL','https://your-local-site-url');
        Replace your-local-site-url with the correct local address (e.g., https://yoursite.local).
      3. Save the file and try to access your site again.

      Option 2: Change the URL in the Local Database

      1. Open Local and go to your site.
      2. Go to the Database tab and open Adminer or phpMyAdmin.
      3. Find the wp_options table (or {your_prefix}_options if you use a custom prefix).
      4. Look for the siteurl and home rows, and change them back to https://your-local-site-url.
      5. Save the changes and reload the site.
      Sarthak Nagoshe

      (@sarthaknagoshe2002)

      If you want to turn on maintenance mode and redirect non-logged-in users to a specific page without using code, here’s a simple way to do it with WordPress features and plugins: Steps:

      1. Set your front page:
        You’ve already set the specific page you want as your “Front Page.” This will be the main page visitors see, so this step is done.
      2. Redirect other pages for non-logged-in users:
        You can use a plugin that redirects users based on whether they are logged in or not.

      Using a Redirection Plugin (like the Redirection plugin):

      1. Install and activate the plugin:
      • Go to Plugins > Add New in your WordPress dashboard.
      • Search for Redirection and install it.
      • Activate the plugin.
      1. Set up the redirection rules:
      • Go to Tools > Redirection.
      • Click Add New.
      • Set the source URL as /(.*) to catch all pages.
      • Set the target URL as your front page (e.g., https://yoursite.com/front-page/).
      • In the Conditions section, set it to redirect only if the user is not logged in.

      This rule will make sure non-logged-in users are sent to your front page.

      1. Check your headers and footers:
        Since your page is built with Elementor and already includes the right header/footer, there’s no extra work needed to keep the design.

      The result:

      • Logged-in users/admins: They can still access all other pages.
      • Non-logged-in visitors: They’ll be automatically redirected to your front page and see the page with your chosen design.

      This method is easy to use and doesn’t require coding while keeping your layout and design intact.

      Sarthak Nagoshe

      (@sarthaknagoshe2002)

      I can see that you have added a slider which seems to be empty thus producing empty space

    Viewing 7 replies - 1 through 7 (of 7 total)