Forum Replies Created

Viewing 15 replies - 1 through 15 (of 71 total)
  • Benjamin Zekavica

    (@benjamin_zekavica)

    Hallo @michelles00 ,
    please post your debug.log here. Please follow this instruction:

    • Use an FTP client or File Manager in your hosting panel.
    • Open the wp-config.php file.
    • Look for this line: define('WP_DEBUG', false);
    • Change it to: define('WP_DEBUG_LOG', true);
    • Save the file and try again.
    • If an error log appears in wp-content/debug.log, share the details with your web host or a developer.

    Hallo @leventna

    in your Header you have a CSS Filter. Remove this:

    body.elementor-page-2153 header section?{
    filter: invert(1) brightness(1);
    }

    Hallo @financialcalculators

    It looks like you’ve run into a problem where the Save button doesn’t appear when using the WP_Widget class, but it works fine with the older wp_register_sidebar_widget() and wp_register_widget_control() functions. This behavior is not expected—WP_Widget should work properly with the widget editor, even for classic (non-block) widgets. Here’s a detailed look at potential causes and fixes for this issue. Potential Causes

    1. Missing form() Method Output:
      • The form() method in the WP_Widget class is responsible for displaying the widget settings in the admin, which also includes generating the necessary form fields for saving the widget. If the form doesn’t properly generate, the Save button won’t appear.
      In your code, the form function seems fine, but double-check that the method is properly outputting the necessary form fields: public function form($instance) { ac_your_name_two_display_form($instance, $this); } Ensure the ac_your_name_two_display_form() function is outputting the necessary input fields.
    2. Incorrect Use of get_field_id() and get_field_name():
      • These methods are crucial for the WP_Widget class to properly link the form fields with their values. It looks like you’re using them correctly, but it’s worth verifying that the field IDs and names are generated properly and unique.
      In your form function:
       <input class="widefat" id="<?php echo esc_attr($widget->get_field_id('default_name')); ?>" 
              name="<?php echo esc_attr($widget->get_field_name('default_name')); ?>" 
              type="text" value="<?php echo esc_attr($default_name); ?>" />
    1. JavaScript Issues in the Widget Editor:
      • WordPress’s block-based widget editor (introduced in WordPress 5.8) sometimes causes compatibility issues with classic widgets. If there are any JavaScript errors on the Appearance → Widgets page, it can prevent the Save button from appearing or functioning correctly.
      To check for JavaScript errors:
      1. Open the browser’s developer tools (usually by pressing F12 or Ctrl+Shift+I).
      2. Go to the Console tab and look for any JavaScript errors when loading the widget page.
      3. If any errors appear, it could be a sign of a conflict or issue that prevents the Save button from being displayed.

    Additional Debugging Tips

    • Revert to Classic Widgets Editor: If you’re using the block-based widget editor (introduced in WordPress 5.8), you can try disabling it temporarily to see if the Save button works with the classic widget editor:
      1. Add the following line to your theme’s functions.php file:
        php add_filter('use_widgets_block_editor', '__return_false');
      2. This will disable the block-based widget editor and revert to the classic one. Check if the Save button appears now.
    • Check for Caching or Minification: Sometimes caching or JavaScript/CSS minification can interfere with the widget editor. Ensure there’s no active caching or minification (especially in your browser or hosting environment) that could interfere with the WordPress admin pages.

    Conclusion

    Your WP_Widget implementation looks generally correct, so the issue could be related to how the new block-based widget editor interacts with classic widgets or potentially some form of JavaScript error on the widget page. Disabling the block-based widget editor might resolve the issue or at least help diagnose it further.

    Let me know if this helps or if you’d like further assistance in debugging the issue!

    Hallo @elsoar

    Currently, most popular free WordPress backup plugins, like UpdraftPlus and BackWPup, only support backing up the WordPress directory and database, without allowing you to include folders outside the WordPress installation directory (such as public_html/anotherfolder). Typically, adding external folders to a backup is considered an advanced feature, which is why it is often included only in premium versions of backup plugins.

    However, if you’re looking for a free solution, there are a couple of approaches you could try:

    1. Custom Script and Backup Plugin Combination

    • You can create a custom backup script to zip the folder public_html/anotherfolder and store it in a directory inside your WordPress installation (e.g., public_html/wp-content/uploads/backup/).
    • Once that folder is within the WordPress directory, use a free plugin like UpdraftPlus (free version) or BackWPup to back up the entire WordPress directory, which will now include your custom folder.

    2. Manual Inclusion Using cPanel/Hosting Backup

    • Some hosting providers offer built-in backup solutions that allow you to specify which folders you want to back up. You could manually include both the public_html/anotherfolder directory and the WordPress folder in those backups.

    While these options may require manual setup or workarounds, they could help you achieve the goal without purchasing a premium backup plugin.

    If you specifically need a WordPress plugin that directly handles this feature for free, it is unlikely such a plugin exists with the required level of flexibility.

    Hallo @raunhar, to add the current page name to the breadcrumbs in WordPress without using plugins, you can create a custom breadcrumb function. Here’s a concise way to do it: Step 1: Add Breadcrumb Function to Your Theme

    1. Edit your theme’s functions.php file and add the following function:

    Step 2: Add Breadcrumbs Code to Your Theme

    function custom_breadcrumbs() {
    // Settings
    $separator = ' &raquo; ';
    $home_title = 'Home';

    // Get the query & post information
    global $post;

    // Build the breadcrumbs
    echo '<ul id="breadcrumbs">';

    // Do not display on the homepage
    if ( !is_front_page() ) {

    // Home page
    echo '<li><a href="' . get_home_url() . '">' . $home_title . '</a></li>' . $separator;

    if ( is_single() || is_page() ) {
    // Standard page or single post
    echo '<li>' . get_the_title() . '</li>';
    } elseif ( is_category() ) {
    // Category page
    echo '<li>' . single_cat_title('', false) . '</li>';
    } elseif ( is_tag() ) {
    // Tag page
    echo '<li>' . single_tag_title('', false) . '</li>';
    } elseif ( is_day() ) {
    // Day archive
    echo '<li>' . get_the_time('Y') . '</li>' . $separator;
    echo '<li>' . get_the_time('F') . '</li>' . $separator;
    echo '<li>' . get_the_time('d') . '</li>';
    } elseif ( is_month() ) {
    // Month archive
    echo '<li>' . get_the_time('Y') . '</li>' . $separator;
    echo '<li>' . get_the_time('F') . '</li>';
    } elseif ( is_year() ) {
    // Year archive
    echo '<li>' . get_the_time('Y') . '</li>';
    } elseif ( is_author() ) {
    // Author archive
    echo '<li>' . get_the_author() . '</li>';
    } elseif ( get_query_var('paged') ) {
    // Paginated archives
    echo '<li>' . __('Page') . ' ' . get_query_var('paged') . '</li>';
    } elseif ( is_search() ) {
    // Search results page
    echo '<li>' . __('Search results for: ') . get_search_query() . '</li>';
    } elseif ( is_404() ) {
    // 404 page
    echo '<li>' . __('Error 404') . '</li>';
    }
    }
    echo '</ul>';
    }
    1. Edit your theme’s header.php, page.php, single.php, or wherever you want the breadcrumbs to appear.
    2. Add the following code where you want the breadcrumbs to be displayed:
    if ( function_exists('custom_breadcrumbs') ) {
    custom_breadcrumbs();
    }

    This setup will display breadcrumbs with the current page name, formatted as Home – Contact Us instead of Home – Page. The function covers various types of pages, including posts, categories, tags, archives, and more.

    Hallo @gregwapling ,

    1. Update wp-config.php

    1. Access cPanel File Manager and navigate to your WordPress root directory (e.g., public_html).
    2. Edit wp-config.php and add these lines before /* That's all, stop editing! Happy blogging. */: define('WP_HOME', 'https://yournewdomain.com'); define('WP_SITEURL', 'https://yournewdomain.com');

    2. Update URLs in the Database

    1. Access phpMyAdmin from cPanel.
    2. Select your WordPress database.
    3. Run these SQL queries (replace yournewdomain.com and yourolddomain.com with your actual new and old domain names):
    UPDATE wp_options SET option_value = replace(option_value, 'https://yourolddomain.com', 'https://yournewdomain.com') WHERE option_name = 'home' OR option_name = 'siteurl';
    UPDATE wp_posts SET guid = replace(guid, 'https://yourolddomain.com','https://yournewdomain.com');
    UPDATE wp_posts SET post_content = replace(post_content, 'https://yourolddomain.com', 'https://yournewdomain.com');
    UPDATE wp_postmeta SET meta_value = replace(meta_value,'https://yourolddomain.com','https://yournewdomain.com');

    Or use a plugin: https://www.ads-software.com/plugins/better-search-replace/

    3. Clear Cache
    Clear any caching plugins or server-side caches if you have them.

    4. Test Your Site.
    Access your site with the new domain and try logging in to the WordPress admin area.

    These steps should resolve the domain change issues and allow you to access your WordPress site normally.

    Forum: Fixing WordPress
    In reply to: error log problem

    Hallo @monoor ,
    replace this line – currently you have a path inside. You only have to use here a boolean (true, false)

    define( 'WP_DEBUG_LOG', true );

    Hallo @incrediblewp ,

    enqueuing assets conditionally in WordPress blocks can indeed be a bit tricky, especially with the shift to the block.json registration approach. Here are the best practices and solutions for both your main concerns: Conditionally Loading Assets for Custom Blocks

    When you register a block using block.json, WordPress enqueues the scripts and styles defined there by default, regardless of whether the block is used on the page or not. To load assets only when a block is present, you can leverage the render_block filter.

    Here’s how you can do it:

    1. Register your block using block.json: This should already be done.
    2. Deregister the block’s frontend assets and load them conditionally:
    function conditionally_enqueue_block_assets( $block_content, $block ) {
        // Check if the specific block is being rendered
        if ( 'namespace/block-name' === $block['blockName'] ) {
            // Enqueue your script or style here
            wp_enqueue_script( 'namespace-block-frontend-script' );
            wp_enqueue_style( 'namespace-block-frontend-style' );
        }
        return $block_content;
    }
    add_filter( 'render_block', 'conditionally_enqueue_block_assets', 10, 2 );

    This code checks if the specific block (namespace/block-name) is being rendered, and if so, enqueues the necessary scripts and styles. Localizing Scripts Registered via block.json

    Localizing scripts that are registered via block.json can indeed be cumbersome, especially if you don’t know the handle. Here’s a more systematic approach:

    1. Register a dummy script in block.json:
       {
         "name": "namespace/block-name",
         "title": "Block Name",
         "category": "widgets",
         "icon": "smiley",
         "editorScript": "file:./build/index.js",
         "editorStyle": "file:./build/editor.css",
         "style": "file:./build/style.css",
         "script": "file:./build/frontend.js" // Dummy script to get a handle
       }
    1. Localize the script in PHP:
       function localize_block_scripts() {
           // Get the block script handle from the block.json (replace 'namespace/block-name' with your block name)
           $block_asset = include plugin_dir_path( __FILE__ ) . 'build/index.asset.php'; // Adjust path accordingly
           $script_handle = 'namespace-block-name-frontend-script'; // Extracted from the HTML as you did
    
           wp_localize_script( $script_handle, 'myBlockData', array(
               'ajax_url' => admin_url( 'admin-ajax.php' ),
               'nonce'    => wp_create_nonce( 'my_nonce' ),
           ));
       }
       add_action( 'wp_enqueue_scripts', 'localize_block_scripts' );
    1. Use the render_block filter to conditionally enqueue assets only when your block is present.
    2. Localize scripts by first registering a dummy script in block.json, and then using the extracted handle in PHP to call wp_localize_script.

    I hope this is helpful for you ??

    Hallo @marioscomco ,

    you can create your Child Theme / Theme and open the header.php and add this code on the place, where you want to display it.

    <?php echo do_shortcode("[gtranslate]"); ?>

    Hallo @luxworx you should update your PHP to 8.0 or 8.1.
    Currently 8.2 WordPress Support is only in Beta.

    Greeting
    Benjamin Zekavica

    Hallo @mabufoysal,

    yes use this Filter wp_nav_menu or you can write a WP Menu Walker that allows you to use Shortcodes inside the Menu. Alternative you can use the Plugin.

    More Details you can find here:
    https://developer.www.ads-software.com/reference/classes/walker/
    https://developer.www.ads-software.com/reference/functions/do_shortcode/

    Hallo @mxahmed,

    maybe try to give your select list an ID.

    Where one Code Example: You can debug it with console.log and Check it if the URL in the Attribute is valid.

    $(document).ready( function() {
       $('#select').change( function() {
          location.href = $(this).val();
       });
    });
    
    <select id="select">
        <option value="#">Select a location</option>
        <option value="location.htm">Location</option>
        <option value="other.htm">Other</option>
    </select>

    Hallo @sayan5561,

    do you can comment here the content of the debug.log?
    Do you can find it on your Server under this path: wp-contents/debug.log

    Alternative you will have received an email with detail informationen.

    Greetings
    Benjamin

    Hallo @mabufoysal,

    you can do this via PHP. But if you want to do that, you can try to use this plugin:
    https://www.ads-software.com/plugins/megamenu/

    PHP Example without Plugin:

    if ( ! has_filter( 'wp_nav_menu', 'do_shortcode' ) ) {
        add_filter( 'wp_nav_menu', 'shortcode_unautop' );
        add_filter( 'wp_nav_menu', 'do_shortcode', 11 );
    }

    Documentation: https://developer.www.ads-software.com/reference/functions/wp_nav_menu/

    Greetings
    Benjamin

    Hallo @matomaki64,

    please check your theme. It could be that your Theme Override your settings.
    Look on this files home.php or front-page.php Make sure to rename it firstly or remove it (Backup before) and clone the page.php and rename it to front-page.php.

    Here you can learn more about the Template Hierarchy in WordPress:
    https://developer.www.ads-software.com/themes/basics/template-hierarchy/

    I hope this will help you ??

    Greetings
    Benjamin

Viewing 15 replies - 1 through 15 (of 71 total)