‘ ‘ used to echo phrases
. to concatenate
$[term] to define a variable
echo to display content
$post (WP_Post) The post object for the current post.
$authordata (WP_User) The author object for the current post
Define current user information
Display all user data
user_login.'
';
echo 'Email: '.$current_user->user_email.'
';
echo 'First Name: '.$current_user->user_firstname.'
';
echo 'Last Name: '.$current_user->user_lastname.'
';
echo 'Display Name: '.$current_user->display_name.'
';
echo 'User ID: '.$current_user->ID.'
';
?>
Basic ACF PHP Functions
get_field() // Returns the value of a specific field.
get_field_object() // Returns the settings of a specific field.
get_field_objects() // Returns the settings of all fields saved on a specific post.
get_fields() // Returns an array of field values (name => value) for a specific post.
the_field() // Displays the value of a specific field.
Add PHP Custom Post Types
// Register Post Types
$init->registerPostTypes([
'people' => [
'plural' => 'People',
'singular' => 'Person',
'supports' => ['title', 'editor', 'excerpt'],
'permaLink' => 'leaders/board/{slug}',
'public' => true
],
'media' => [
'plural' => 'Media Posts',
'singular' => 'Media Post',
'supports' => ['title', 'editor', 'excerpt'],
'permaLink' => 'media/the-front/{slug}',
'public' => true
],
'publication' => [
'plural' => 'Publications',
'singular' => 'Publication',
'supports' => ['title', 'excerpt'],
'permaLink' => 'publications/category/{slug}',
'public' => true
],
'tmg_update' => [
'plural' => 'TMG Updates',
'singular' => 'TMG Update',
'supports' => ['title', 'editor'],
'public' => false,
'search' => false
],
'tmg_contact' => [
'plural' => 'TMG Contacts',
'singular' => 'TMG Contact',
'supports' => ['title'],
'public' => false,
'search' => false
],
'tmg_toolbox' => [
'plural' => 'TMG Toolbox',
'singular' => 'TMG Toolbox',
'supports' => ['title'],
'public' => false,
'search' => false
],
'tmg_media' => [
'plural' => 'TMG Media',
'singular' => 'TMG Media',
'supports' => ['title', 'editor'],
'public' => true,
'permaLink' => 'account/media/{slug}',
'search' => false
],
'quote' => [
'plural' => 'Quotes',
'singular' => 'Quote',
'supports' => ['title'],
'public' => false,
'search' => false
],
]);