Documentation – get_screenwriter()

This function will return a Screenwriter data object.

Usage

$screenwriter = get_screenwriter( $id, $key );

Parameters

$id (integer) (optional)
The ID of the post from which you want to return data. Use the get_the_id() function or global $post object ID (eg $post->ID) to get the value dynamically.

Default: none

$key (string) (optional)
A string value specifying the unique key used to save data to the WordPress post_meta table. A unique key is required to separate data from different Screenwriter instances, preventing possible conflicts.

Default: ‘sc_screenwriter’

Return Value

  • If $id is left blank the function returns results for the current post, page or custom post type.
  • If $id is specified, the function returns results for the specified post, page or custom post type.
  • If $key is specified, the function returns results from that Screenwriter instance.

Examples

Get the Screenwriter data object for current post.

<?php $screenwriter = get_screenwriter(); ?>

Get the Screenwriter data object for the post with the id of 5.

<?php $screenwriter = get_screenwriter(5); ?>

Notes

  • Values can also be accessed manually using WordPress’s get_post_meta() function and passing ‘sc_screenwriter’ (or a custom key value) as the specified key.