WordPress.org

Ready to get started?Download WordPress

Forums

Advanced Custom Field Widget
[resolved] Shortcode in Custom Field Possible? (5 posts)

  1. polins
    Member
    Posted 2 years ago #

    I love the plugin! It's great for selectively putting a particular ad on a given set of pages.

    Is there a way for me to execute a shortcode if inserted into the custom field value?

    http://wordpress.org/extend/plugins/advanced-custom-field-widget/

  2. athenaofdelphi
    Member
    Plugin Author

    Posted 2 years ago #

    Hi polins,

    Apologies for the delay in responding... I don't very often check the forums here.

    I've just checked the codebase and it should definitely pass the content through the short code processor. Can you provide more detail, like details of the plugin that provides the shortcode, the shortcode itself etc. so I can look at setting up a test on my development blog.

    If I can reproduce the problem, I should be able to fix it.

    Regards

    Athena

  3. polins
    Member
    Posted 2 years ago #

    The sidebar widget displays on pages with the appropriate text in the custom field, but there is an additional error message shown within the widget output:

    Parse error: syntax error, unexpected $end in /home/mydirectory/public_html/mydomain/wp-content/plugins/advanced-custom-field-widget/adv-custom-field-widget.php(566) : eval()'d code on line 1

    This shows up with shortcodes generated by such plugins as "Shortcodes Ultimate" or "Postcontent in Shortcodes", for example. The error message is the same, regardless of the particular shortcode used. (WP 3.2.1, ACFW version 0.9.9). Thanks!

  4. athenaofdelphi
    Member
    Plugin Author

    Posted 2 years ago #

    Hi polins,

    The problem is the " characters that can be embedded in the content.

    Depending on how you use the widget, you may be able to fix it by changing this line:-

    eval( '$cvalue="\n<div class=\"advcustomvalue\">\n' . $cvalue . '\n</div>\n";' );

    To:-

    $cvalue="\n<div class=\"advcustomvalue\">\n".$cvalue."\n</div>\n";

    However, you should be aware that this can prevent the replacement of strings like '$acfw_content' in the content generator.

    I can't offer an updated version of the widget at this time because of the potential for it to break other peoples sites. I have a possible solution, but I just want to be sure it's going to work.

    Hope this helps until I can provide a more permanent solution.

    Regards

    Athena

  5. athenaofdelphi
    Member
    Plugin Author

    Posted 1 year ago #

    No further comments/actions on this request in about 9 months, so I'm going to mark this thread as resolved.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic