WordPress.org

Ready to get started?Download WordPress

Forums

ShortCodes UI
[resolved] error after editing & re-saving page with the shortcode (2 posts)

  1. SiteSubscribe
    Member
    Posted 1 year ago #

    Hi. I'm having some issue with PHP.

    Fatal error: Call to a member function list_attributes() on a non-object in /home/wpmash/public_html/incadventures/wp-content/plugins/shortcodes-ui/shortcode-maker.php(1197) : eval()'d code on line 4

    I only get the error when I save or resave a post that has the associated shortcode. And what's really odd is I only get the error sometimes when saving, not every time.

    [attribs]

    I'm adding the following php into php section as advanced mode:

    global $woocommerce, $post, $product;
    echo "<div class='fast-facts'>";
    echo "<h2>Fast Facts</h2>";
    $product->list_attributes();
    echo "</div>";

    This code for displaying WooCommerce custom attributes within a page seems to work sometimes, but as I said, throws error after editing and re-saving the page with the shortcode in it.

    I've tried changing the setting: 'my code uses PHP echo' to 'return', but it seems to work the same either way (I would think 'echo' would apply here).

    I get the php error on a white screen. If I reopen the page editor on another browser tab the page changes actually saved properly, and the page displays the WooCommerce attributes on the page as expected.

    http://wordpress.org/extend/plugins/shortcodes-ui/

  2. Bainternet
    Member
    Plugin Author

    Posted 1 year ago #

    This clearly states that you have an error with your code on this line

    $product->list_attributes();

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.