Documentation – get_mockingbird_config()

This function returns the global Mockingbird config object or the inline config object for a specific post.

Usage

$config = get_mockingbird_config( $id, $key );

Parameters

$id (integer) (optional)
The ID of the post from which you want to return data. Use the get_the_id() function while in the loop to get the post’s ID, or use your sub-loop’s post object ID property (eg $my_post_object->ID). You may also use the global $post object ID (eg $post->ID). Set to false to return the global config object.

Default: false

$key (string) (optional)
A string value to specify the meta key used to retrieve saved mockingbird data. If additional Mockingbird instances have been created, a unique key is required to distinguish it from other instances. Aimed at advanced development, its unlikely that you will need to deviate from the default key during standard development.

Default: ‘sc_mockingbird’

Examples

Get the global Mockingbird config object.

<?php $config = get_mockingbird_config(); ?>

Get the inline Mockingbird config object for the current post.

<?php $config = get_mockingbird_config(get_the_id()); ?>

Get the global Mockingbird config object for the current post using a custom key.

<?php $config = get_mockingbird_config(false, 'testimonials'); ?>

Notes

  • To allow inline post configuration make sure the “Inline configuration” option is selected in the Mockingbird settings.
  • Values can also be accessed manually using WordPress’s get_option() function and passing ‘sc_mockingbird_options’ (or a custom key value) as the specified key.