Skip to Content


Show the author post metadata.

PHP March 25, 2020


nebula()->post_author($icon, $linked, $force)


(Optional) (Boolean) Whether to show the "icon", "text" or not
Default: icon

(Optional) (Boolean) Whether it should be linked
Default: true

(Optional) (Boolean) Force the data regardless of Nebula Options
Default: false

Request or provide clarification »


Using post_meta:
Using individual Nebula post meta functions with options:
  • Posted in PHP by
  • Modified on
  • Custom Format:
Other Nebula meta functions:
  • Function
  • No EXIF data found

Source File

Located in /libs/Functions.php on line 508.

1 Hook

Find these filters and actions in the source code below to hook into them. Use do_action() and add_filter() in your functions file or plugin.

Need a new filter hook? Request one here.

This function has no action hooks available. Request one?

        public function post_author($options=array()){
            $defaults = apply_filters('nebula_post_author_defaults', array(
                'label' => 'icon', //"icon" or "text"
                'linked' => true, //Link to author page
                'force' => false, //Override author_bios Nebula option

            $data = array_merge($defaults, $options);

            //Include support for multi-authors: is_multi_author

            if ( ($this->get_option('author_bios') || $data['force']) && get_theme_mod('post_author', true) ){
                $label = '';
                if ( $data['label'] === 'icon' ){
                    $label = '<i class="nebula-post-author-label fas fa-fw fa-user"></i> ';
                } elseif ( $data['label'] === 'text' ){
                    $label = '<span class="nebula-post-author-label">Author </span>';

                //Get the author metadata
                $author_id = get_the_author_meta('ID');
                if ( empty($author_id) ){ //Author ID can be empty outside of the loop
                    global $post;
                    $author_id = $post->post_author;
                    $author_name = get_the_author_meta('display_name', $author_id);
                } else {
                    $author_name = get_the_author();

                if ( $data['linked'] && !$data['force'] ){
                    return '<span class="posted-by" itemprop="author" itemscope itemtype="">' . $label . '<span class="meta-item entry-author"><a href="' . get_author_posts_url($author_id) . '" itemprop="name">' . $author_name . '</a></span></span>';
                } else {
                    return '<span class="posted-by" itemprop="author" itemscope itemtype="">' . $label . '<span class="meta-item entry-author" itemprop="name">' . esc_html($author_name) . '</span></span>';


This function can not be short-circuited with an override filter. Request one?