Search Results for 'guest'

    No search results were found in Documentation!

Results from the Forum
Radu
tagDiv Staff

Hi,


@mbasche
yes.. you are right, the code snippets are from an older version of newspaper.


@lucioluci
the code snippet provided by @partnowjess has to be modified to work in the current version.

http://screencast.com/t/ehsvNrSegqf
current version of the code (not tested yet):


<?
//$buffy .= $this->get_author();
$coauths = get_coauthors();
if (count($coauths) > 1) {
    echo "by ";
    foreach($coauths as $key => $coauth) {
	    echo '<a href="/author/'.$coauth->user_nicename.'">'.$coauth->display_name.'</a>';
		
		// add "and"
		if ($key != count($coauths)) {
			echo ' and ';
		}
    }
} else {
	echo $this->get_author();
}
mbasche
tagDiv Member

Maybe I’m blind, but I thought in the current Newspaper version 3.8.3.3 a single article is shown through the “loop-single.php”. And the code for the author is <?php echo $td_mod_single->get_author();?> and not $buffy .= $this->get_author(); ..?

partnowjess
tagDiv Member

Here is the code we came up with:

//$buffy .= $this->get_author();
                    $coauths = get_coauthors();
 
$coauthsHTML = '';
 
if (count($coauths) > 1) {
 
    $coauthsHTML .= "by ";
 
    foreach($coauths as $coauth) {
 
        $coauthsHTML .= '<a href="/author/'.$coauth->user_nicename.'">'.$coauth->display_name.'</a> and ';
 
    }
 
    $coauthsHTML = substr($coauthsHTML, 0, -4);
 
    $buffy .= $coauthsHTML;
 
}else{
 
        $buffy .= $this->get_author();
 
}

It shows up in most of the includes/modules files. I just looked for everywhere this line exists:

$buffy .= $this->get_author();

And replaced it with the above. Hope that helps!

lucioluci
tagDiv Member

@partnowjess hello! I saw now your theme works fine with the two authors in loop too. May you explain how do you made this please? my co author plus works just on single pages 🙁

jankosh
tagDiv Member

Hi Marius,
yes I have read this https://forum.tagdiv.com/translate-your-site-in-multiple-language-with-qtranslate-plugin/

The theme works with qTranslate almost perfect, except for custom built pages.

Website is still in development mode but I did set an account for you to take a look

http://jazykove-new.fairlist.cz/
username: guest
password: abc123

In the upper right corner you can switch between Czech and English language.
Notice the posts and right-hand side widget on homepage. You can see there are posts for both languages no matter which one you select. The problem is that not all posts are translated, so we need to show only those which are.

Category pages show only what is desired – posts in the selected language. But there’s a little problem here also – category description is being shown in both languages, the theme ignores qTranslate tags.

Homepage is custom page built as “Homepage – blank” and with no sidebar. However, sidebar is made in the page builder, so it shows as it is supposed to, except language settings. The reason for this is that I didn’t want to show page title on homepage.

Thank you for your reply.

  • This reply was modified 12 years by jankosh.
alopfr
Participant
#0

Hello,

How could I change the authors tags in order to put on the Co-Authors Plus plugin? I think you have to explain us, because the structure of the Newspaper theme isn’t like others, and we don’t know how we do it.

Thanks

(http://vip.wordpress.com/documentation/add-guest-bylines-to-your-content-with-co-authors-plus/)

cityslicker444
Participant
#0

Hello, I love the theme, but I was wondering how I can remove the author box from only one user? I have several users, each with their own bio, but then I have a user called “Guest” which is for anybody who just has a guest post once or twice. This user doesn’t have a bio, since it encompasses many different people, so I’d just like to get rid of the author box for this user, but not the others. How can I do this?

partnowjess
tagDiv Member

Arrg! I am sure it’s so close to working, but I can’t get it to. Thank you so much for your help, but when I insert the code it just keeps breaking the page.

webmaster808
tagDiv Member

I just looked at the source of the plugin again and there is a function that returns IDs! Yay!

So in lieu of that, you could try:


// Lets get the IDs of the co-authors
$user_ids = get_coauthors_IDs();
//Iterates through the user ids
foreach($user_ids as $coauthor_id){
	//creates an author box for each of the coauthor ids
	$buffy .= get_author_box($coauthor_id);
}

If this works, it will only work for co-authors that have an author account in your system that has a unique email address, not the pseudo ones that the plugin can create.

webmaster808
tagDiv Member

No, unfortunately it’s not that easy. It is looking weird because the coauthors boxes are being returned by the Co Authors plugin(using it’s own markup and styling), while the Author box is being returned by the Newspaper Theme’s functions(using different markup and styling). They are not interchangeable.

However, you can choose to use one or the other system in the template.

In your td_module_1(or whatever one, not td_module_blog) you could try replacing $buffy .= $this->get_author_box(); with:


// Get an array of all the co-authors
$my_coauthors = get_coauthors();

// Count the indexes in the array
if(count($my_coauthors) > 1 ){

	// There is more than 1 index in $my_coauthors, output all of them with the coauthor plugin function
	$buffy .= get_coauthors();

} else {

	// There is only one Author, let's output that one with the Theme function
	$buffy .= $this->get_author_box();
	
}

If you want the output of the Co Author’s plugin to look like the output of the Newspaper Theme Author Box, then you have some css work to do.

partnowjess
tagDiv Member

I think I’m getting very close to figuring this out, but not quite there…any suggestions much appreciated!

Here’s what we’ve got:

*I am using “Co-Authors Plus” that allows you to assign 2 authors to one post. This is an example: http://www.seattleglobalist.com/2013/12/30/an-elusive-japanese-new-years-treat-returns-to-seattle/18592 this post has two authors on the backend, but only one displays on the post.

*I’ve added template tags to functions.php, per these instructions. and I know it’s kinda sorta working ’cause I can get the two author names to show up (but looking totally weird) by adding a line:

$buffy .= get_coauthors();

to td_module_1.php.

*I *think* that I have to add some kind of conditional to this section of td_module_blog.php, to make this work:


function get_author_box($author_id = '') {

        if (!$this->is_single) {
            return;
        }

        if (td_util::get_option('tds_show_author_box') == 'hide') {
            return;
        }

        if (empty($author_id)) {
            $author_id = $this->post->post_author;
        }

right?? like incorporating something here that says “if there are two authors for this post, then use the coauthors tag instead of the author tag”.

Is that possible?

Thanks!!

webmaster808
tagDiv Member

The get_author_box() function is what Newspaper uses to display Author info on the front end. This function takes a single user ID and generates everything from that. After a quick glance at the code it looks like what needs to be done is to convert the output of the Co-Authors plugin to an array of IDs so that we can iterate over it to get the get_author_box() function to create the boxes using the Author IDs:

First, you would need something like this(assuming you have the Co-Authors Plus plugin installed) in the functions.php:

if(function_exists('coauthors')){

	$coauthor_names = coauthors( null, null, null, null, false );
	$user_ids = array();

	function coauthor_names_to_ids(){
		$names = explode(' ', $coauthor_names);

		foreach($names as $name){
			// We would probably need to add another function here to make sure that the $name matches any one of our authors slugs and then if $name == 'author-slug' then we could procede to get the ID and add it to the $user_IDs array so that we only have an array of valid IDs.
			$user = get_user_by( 'slug', wptexturixe($name));
			$user_ids[] .= $user->ID;
		}
		return $user_ids;
	}
coauthor_names_to_ids();
}

And then all you would have to do get them to appear on the front end (in td_module_1 for example) is something like this:

//Iterates through the user ids
foreach($user_ids as $coauthor_id){
	//creates an author box for each of the coauthor ids
	$buffy .= get_author_box($coauthor_id);
}

I haven’t debugged this code, some work would probably need to be done to make sure the exploded $names array matches slugs properly but it appears to be one way to tackle the problem. Another would be to modify the Co-Authors plugin to be able to return the co-author IDs as well as links. I suppose you could also modify the get_author_box() function to accept the author name as an argument…

  • This reply was modified 12 years by webmaster808. Reason: Forgot to call the function!
partnowjess
tagDiv Member

I am trying to integrate this plugin into our site (following these instructions), but having trouble identifying where & how to integrate the template tags.

I think it needs to get added to this code from td_module:

$buffy .= '<span class="td-block-author">';
                $buffy .= __td('by', TD_THEME_NAME);
                $buffy .= ' ';
                $buffy .= '<a itemprop="author" href="' . get_author_posts_url($this->post->post_author) . '">' . get_the_author_meta('display_name', $this->post->post_author) . '</a>' ;
                $buffy .= ' - ';
            $buffy .= '</span>';

But I can’t figure out exactly what to add. Can you help get me going in the right direction?

Our site is here: http://seattleglobalist.com
And here’s an example of a post with two authors (though they don’t display on the front end currently): http://www.seattleglobalist.com/2013/12/30/an-elusive-japanese-new-years-treat-returns-to-seattle/18592

iotivedo
tagDiv Member

I can try a manual patch on the theme, but where are the the_author_posts_link() equivalent functions?

iotivedo
tagDiv Member

Someone try to integrate co-authors plus plugin? I need this
feature too.

Marius
tagDiv Staff

Hello,
I’ve added to our todo list for the following updates, but please take in consideration that this is not a priority right now.

Ask a freelancers for a custom integration if you want.
Thanks for understanding.
Marius from tagDiv

syfax
tagDiv Member

I tried that, but I’m no PHP-expert, so I can only follow the plugin support.

I actually made it show the guest author name (only one, not two), but it didn’t integrate well. On the author page it adds the number of post of the guest order and the ‘real’ author.

I am not able to twist the code anymore from here, so I hope tagDiv will consider integrating with the Co Author Plus plugin.

Thanks.

mbasche
tagDiv Member

For the plugins you have to insert the specific code!

syfax
tagDiv Member

Thanks for your answers. I solved number 3 with the de comment.

Regarding number 1 and 2 – I tried with the plugins. Co Authors and Co Authors Plus. I can then create guest authors and assign them to posts, but they don’t show up in the post. No matter what, the post displays only one author – and only the ‘real’ author – not the guest author.

Hope you can help.

Marius
tagDiv Staff

Hello,
Thanks @mbasche

2. Try Really Simple Guest Post Plugin or similar
3. De comment this http://screencast.com/t/kKcdlkdXapX

Thanks for the message!

mbasche
tagDiv Member

How about a plugin? Maybe Co Authors Plus

  • This reply was modified 12 years by mbasche.
syfax
Participant
#0

Hi

I would really like to be able to:

1) assign two authors to the same post. And if I do, it needs to show two author boxes on the bottom of the page.

2) create guest authors without creating a WP-account. My authors normally write only one or two posts, and they know nothing about WP.

3) show the name of the author (with a link to author profile page) on the top of the post.

Hope you will consider this. Thanks in advance!

/Thomas

Viewing 22 results - 301 through 322 (of 322 total)