Skip to content

Instantly share code, notes, and snippets.

@ninnypants
Created October 17, 2014 16:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ninnypants/8c66012fa4b7f1e51f4f to your computer and use it in GitHub Desktop.
Save ninnypants/8c66012fa4b7f1e51f4f to your computer and use it in GitHub Desktop.
function widget($args, $instance)
{
$title = apply_filters( 'widget_title', "hallo", $instance, $this->id_base );
// Variables
$acf_key = "widget_" . $this->id_base . "_" . $this->number;
// Debug information
echo "<h3>ACF Key:</h3>";
echo $acf_key . "<br />";
echo "<br />";
echo "<h3>Fields:</h3>";
echo "<pre>";
print_r($instance["fields"]);
echo "</pre>";
echo "<br />";
echo "Use get_field(\"fieldname\", \$acf_key); to get the fields in the widget function.";
echo "<br />";
echo "<br />";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment