Thread Starter
doxtra
(@doxtra)
Hi,
Almost there! I’ve used Miquel’s methodology and replaced the get_the_author tag by a get_coauthors tag in cite.php like this:
function cite_shortcode() {
global $wpcp_setting;
// Getting admin preferred date format for current date
if(!function_exists('displayTodaysDate')){
function displayTodaysDate() {
return date_i18n(get_option('date_format'));
}
}
$find_string = array('{author}','{sitename}', '{title}', '{date}', '{publication_date}', '{permalink}');
$replace_string = array(get_coauthors(), get_bloginfo('name'), get_the_title(), displayTodaysDate(), get_the_date(), '<a href="' . get_permalink() . '">' . get_permalink() . '</a>');
$edited_setting = str_replace($find_string, $replace_string, $wpcp_setting[setting]);
return '<div class="wpcp">' . $edited_setting . '</div>';
}
However, this returns an “Array” print for {authors} (while other tags are ok)…
Did I forget something?
Thread Starter
doxtra
(@doxtra)
I meant {author} tag in the previous post.
Thread Starter
doxtra
(@doxtra)
Hi,
We figured out that we only had to use coauthors() in cite.php like this:
$find_string = array('{author}','{sitename}', '{title}', '{date}', '{publication_date}', '{permalink}');
$replace_string = array(coauthors(), get_bloginfo('name'), get_the_title(), displayTodaysDate(), get_the_date(), '<a href="' . get_permalink() . '">' . get_permalink() . '</a>');
$edited_setting = str_replace($find_string, $replace_string, $wpcp_setting[setting]);
return '<div class="wpcp">' . $edited_setting . '</div>';
And it worked! However, the names are printed twice now. If you’re facing the same issues, we’ve raised the issue here.