Okay
  Public Ticket #1177002
PHP error on internal pages
Closed

Comments

  • Brittney started the conversation

    I am getting this error on internal pages. I am trying to switch to use Visual Composer instead of Beaver Builder and I thought it was coming from that so I disabled VC but I am still seeing it on all internal pages (everything except the front).

    Fatal error: Cannot use string offset as an array in /home/sitename/public_html/wp-content/themes/polyclinic/includes/front/post.php on line 271

  • Brittney replied

    I have disabled line 271 for now just so you know so I can continue to work on these pages as I am on a deadline.

  •  27
    Oliver replied

    Hi Brittney,

    I'm sorry but I can't replicate the issue. Could you please provide the admin access to your website so I can check personally (don't forget to mark your reply as private, please)?

    Best regards,

    Oliver Juhas
    WebMan Design

  •  27
    Oliver replied

    Hi,

    I can see you have modified the theme files. Please note that I can only provide tips for modifications, not full support.

    Also, you should never edit theme core files as you will loose your changes once you update the theme. Please use a child theme instead.

    You can read more at https://webmandesign.eu/manual/polyclinic/#child-theme

    As I have no idea what changes have you applied and what files have you modified, I suggest you to first create a backup of your modified theme, then reupload the original theme anew to see if the PHP error disappears. If its fixed now, you know there is an issue in your theme modifications code. In that case you should go through your theme changes and fix them and reapply them in a child theme.

    Best regards,

    Oliver Juhas
    WebMan Design

  • Brittney replied

    A lot of the changes I have tried to make were not applying to the site in the Child theme that I do have created (ie: I have a header file set up, but nothing would ever look different but if I did the changes directly in the theme versions they would). I tested them a few times, refreshed my cache a few times, and still the pages looked the same. I do intend to switch these changes over to Child versions but since they aren't working I'm not sure how to proceed on that.

  •  27
    Oliver replied

    Hi,

    Please note that you are most likely not doing the changes correctly in a child theme and that's why they are not applied. Maybe you can describe what you need to do in more details so I can provide some tips for you.

    My themes are built using more advanced and much more flexible WordPress coding techniques, using action and filter hooks.

    I do not recommend editing/overriding `header.php` file as you can simply hook onto actions in that file. Actually, all theme HTML is produced using hooks, so you can simply dequeue the ones you don't like or override with your own ones.

    Here are some resources for you to check:

    I'm closing this ticket for now as the PHP error seems to be related to your changes and not the theme code.

    Best regards,

    Oliver Juhas
    WebMan Design

  •  27
    Oliver replied

    Hi,

    Here is an example of the code you can use in your child theme:

    I can see you have added some top bar to your website. It is easier and much more future-proof to add it via your child theme's `funcitons.php` file like this:

    /**
     * Registering Top bar sidebar
     */
    function child_theme_sidebar_top_bar() {
        register_sidebar( array(
            'id'            => 'top-bar',
            'name'          => 'Top bar',
            'description'   => '',
            'before_widget' => '<section id="%1$s" class="widget %2$s">',
            'after_widget'  => '</section>',
            'before_title'  => '<h3 class="widget-title">',
            'after_title'   => '</h3>'
        ) );
    }
    
    add_action( 'widgets_init', 'child_theme_sidebar_top_bar', 1 );
    
    
    
    /**
     * Displaying Top bar sidebar
     */
    function child_theme_html_top_bar() {
        if ( ! is_active_sidebar( 'top-bar' ) ) {
            return;
        }
    
        ?>
        <div class="top-bar-widgets-container">
            <aside id="top-bar-widgets" class="widget-area top-bar-widgets" role="complementary" aria-labelledby="top-bar-widgets-label">
                <h2 class="screen-reader-text" id="top-bar-widgets-label"><?php echo 'Top bar'; ?></h2>
                <?php dynamic_sidebar( 'top-bar' ); ?>
            </aside>
        </div>
        <?php
    }
    
    add_action( 'tha_header_before', 'child_theme_html_top_bar' );
    

    Now you just need to apply your custom styles for this section. Please note that you need to test this for accessibility too if you want your website to be accessible. Please understand I can only provide support and warranty for the original theme code, not the custom modifications.

    Best regards,

    Oliver Juhas
    WebMan Design