Combine code into function
-
Hello, I’m trying to merge the code you gave me previously on another support topic, inside the author function of the List category posts plugin.
This is the function:
public function get_author_to_show($single){ if ($this->params['author'] == 'yes'): $lcp_userdata = get_userdata($single->post_author); $author_name = $lcp_userdata->display_name; if($this->lcp_not_empty('author_posts_link') && $this->params['author_posts_link'] == 'yes'){ $link = get_author_posts_url($lcp_userdata->ID); return "<a href=" . $link . " title='" . $author_name . "'>" . $author_name . "</a>"; } else { return " - <em>por " . $author_name . "</em>"; } else: return null; endif; }
And I’m trying to merge, if that’s the word, inside that function this code:
<?php $author_name = get_post_meta(get_the_ID(), 'user_submit_name', true); if (!empty($author_name)) echo $author_name; ?>
With this i want to show the user submitted post author (not the one auto-assigned) on the list of post of a certain category.
Can you help me to achieve this? I’m trying to do it by myself, but I’m failing to realize how to do it properly :(.
Thanks in advance!
Best regards.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Combine code into function’ is closed to new replies.