Browse Source

Copy the current version of Widget for Co-Authors

master
ulaulaman 2 months ago
commit
81ff10a5bd
  1. 27
      README.md
  2. 1
      _config.yml
  3. BIN
      assets/banner-772x250.jpg
  4. BIN
      assets/icon-256x256.jpg
  5. BIN
      assets/screenshot-1.jpg
  6. 11
      blog-spoiler.css
  7. BIN
      lang/co-authors-widget-it_IT.mo
  8. 48
      lang/co-authors-widget-it_IT.po
  9. 37
      lang/co-authors-widget.pot
  10. BIN
      lang/widget-for-co-authors-it_IT.mo
  11. 48
      lang/widget-for-co-authors-it_IT.po
  12. 37
      lang/widget-for-co-authors.pot
  13. 36
      readme.txt
  14. 157
      widget-for-co-authors.php

27
README.md

@ -0,0 +1,27 @@
The plugin add a widget and a shortcode in order to show authors of an article. It is compatible with Co-Authors Plus, but it is not strictly required.
# Description
[Co-Authors Plus](https://wordpress.org/plugins/co-authors-plus/) is one of the most useful plugin for multiple authors blogs: using it you can add more than one author to your posts and you can define also guest authors without user creation. Despite this, not all themes are able to show all the authors of a post or to show the avatar of the guest author. This plugin add a widget to show users' avatars to post also for guest authors and for posts with multiple authors.
You can also add avatars using the shordcode [blog-post-coauthors].
The plugin add also a slider in order to show user's profile. If you want change the style, you can modify blog-spoiler.css file in the plugin folder.
# Installation
1. Extract the widget-for-coauthors.zip file and upload its contents to the /wp-content/plugins/ directory. Alternately, you can install directly from the Plugin directory within your WordPress Install.
2. Activate the plugin through the \"Plugins\" menu in WordPress.
3. Add the widget to your sidebar or the shortcode to your posts or pages.
# Changelog
0.6 add author's info also in case Co-Authors Plus doesn't installed<br/>
0.5.3 add the correct lang files<br/>
0.5.2 fix error code in domain name in widget<br/>
0.5.1 fix error code in domain name for messages<br/>
0.5 support for translations<br/>
0.4 translation italian messages in english<br/>
0.3.1 test with wp 4.9.2<br/>
0.3 add profile link and css<br/>
0.2 creation of the widget to show authors' avatars<br/>
0.1 creation of the shortcode to add post's authors
# Screenshot
<div align="center"><img src="https://github.com/ulaulaman/widget-for-co-authors/blob/master/assets/screenshot-1.jpg?raw=true" /><br/>
<em>The result of the widget in a multiple authors post</em></div>

1
_config.yml

@ -0,0 +1 @@
theme: jekyll-theme-leap-day

BIN
assets/banner-772x250.jpg

After

Width: 772  |  Height: 250  |  Size: 62 KiB

BIN
assets/icon-256x256.jpg

After

Width: 256  |  Height: 256  |  Size: 25 KiB

BIN
assets/screenshot-1.jpg

After

Width: 230  |  Height: 252  |  Size: 13 KiB

11
blog-spoiler.css

@ -0,0 +1,11 @@
.read-more-target,
.read-more-trigger_opened {
display: none;
}
.read-more-state:checked ~ .read-more-wrap .read-more-target,
.read-more-state:checked ~ .read-more-trigger_opened {
display: block;
}
.read-more-state:checked ~ .read-more-trigger_closed {
display: none;
}

BIN
lang/co-authors-widget-it_IT.mo

48
lang/co-authors-widget-it_IT.po

@ -0,0 +1,48 @@
# This file is distributed under the same license as the Co-Authors Widget package.
msgid ""
msgstr ""
"Project-Id-Version: Co-Authors Widget 0.4-beta\n"
"Report-Msgid-Bugs-To: https://wordpress.org/plugins/widget-for-co-"
"authors/\n"
"POT-Creation-Date: 2018-01-27 18:24+0100\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: 2018-01-27 18:25+0100\n"
"Language-Team: \n"
"X-Generator: Poedit 1.8.7.1\n"
"Last-Translator: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Language: it_IT\n"
#: co-authors-widget.php:32
msgid "Show profile"
msgstr "Mostra il profilo"
#: co-authors-widget.php:33
msgid "Hide profile"
msgstr "Nascondi il profilo"
#: co-authors-widget.php:95
msgid "Authors"
msgstr "Autori"
#: co-authors-widget.php:98
msgid "Show avatars and names of the authors"
msgstr "Mostra gli avatar e i nomi degli autori"
#: co-authors-plus.php:122
msgid "Written by"
msgstr "Scritto da"
#. Description of the plugin/theme
msgid ""
"The plugin add a widget and a shortcode in order to show authors of an "
"article. It is compatible with Co-Authors Plus."
msgstr ""
"Il plugin aggiunge un widget e uno shortcode per mostrare gli autori "
"di un articolo. Compatibile con Co-Authors Plus."
#. Author of the plugin/theme
msgid "Gianluigi Filippelli"
msgstr "Gianluigi Filippelli"

37
lang/co-authors-widget.pot

@ -0,0 +1,37 @@
# This file is distributed under the same license as the Co-Authors Widget package.
msgid ""
msgstr ""
"Project-Id-Version: Co-Authors Widget 0.4-beta\n"
"Report-Msgid-Bugs-To: https://wordpress.org/plugins/widget-for-co-authors/\n"
"POT-Creation-Date: 2018-01-27 17:49:00+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: co-authors-widget.php:32
msgid "Show profile"
msgstr ""
#: co-authors-widget.php:33
msgid "Hide profile"
msgstr ""
#: co-authors-widget.php:95
msgid "Authors"
msgstr ""
#: co-authors-widget.php:98
msgid "Show avatars and names of the authors"
msgstr ""
#: co-authors-widget.php:122
msgid "Written by"
msgstr ""
#. Description of the plugin/theme
msgid "The plugin add a widget and a shortcode in order to show authors of an article. It is compatible with Co-Authors Plus."
msgstr ""
#. Author of the plugin/theme
msgid "Gianluigi Filippelli"
msgstr ""

BIN
lang/widget-for-co-authors-it_IT.mo

48
lang/widget-for-co-authors-it_IT.po

@ -0,0 +1,48 @@
# This file is distributed under the same license as the Co-Authors Widget package.
msgid ""
msgstr ""
"Project-Id-Version: Co-Authors Widget 0.4-beta\n"
"Report-Msgid-Bugs-To: https://wordpress.org/plugins/widget-for-co-"
"authors/\n"
"POT-Creation-Date: 2018-01-29 23:40+0100\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: \n"
"Language-Team: \n"
"X-Generator: Poedit 1.8.7.1\n"
"Last-Translator: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Language: it_IT\n"
#: widget-for-co-authors.php:32
msgid "Show profile"
msgstr "Mostra il profilo"
#: widget-for-co-authors.php:33
msgid "Hide profile"
msgstr "Nascondi il profilo"
#: widget-for-co-authors.php:95
msgid "Authors"
msgstr "Autori"
#: widget-for-co-authors.php:98
msgid "Show avatars and names of the authors"
msgstr "Mostra gli avatar e i nomi degli autori"
#: widget-for-co-authors.php:122
msgid "Written by"
msgstr "Scritto da"
#. Description of the plugin/theme
msgid ""
"The plugin add a widget and a shortcode in order to show authors of an "
"article. It is compatible with Co-Authors Plus."
msgstr ""
"Il plugin aggiunge un widget e uno shortcode per mostrare gli autori "
"di un articolo. Compatibile con Co-Authors Plus."
#. Author of the plugin/theme
msgid "Gianluigi Filippelli"
msgstr "Gianluigi Filippelli"

37
lang/widget-for-co-authors.pot

@ -0,0 +1,37 @@
# This file is distributed under the same license as the Co-Authors Widget package.
msgid ""
msgstr ""
"Project-Id-Version: Co-Authors Widget 0.4-beta\n"
"Report-Msgid-Bugs-To: https://wordpress.org/plugins/widget-for-co-authors/\n"
"POT-Creation-Date: 2018-01-27 17:49:00+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: widget-for-co-authors.php:32
msgid "Show profile"
msgstr ""
#: widget-for-co-authors.php:33
msgid "Hide profile"
msgstr ""
#: widget-for-co-authors.php:95
msgid "Authors"
msgstr ""
#: widget-for-co-authors.php:98
msgid "Show avatars and names of the authors"
msgstr ""
#: widget-for-co-authors.php:122
msgid "Written by"
msgstr ""
#. Description of the plugin/theme
msgid "The plugin add a widget and a shortcode in order to show authors of an article. It is compatible with Co-Authors Plus."
msgstr ""
#. Author of the plugin/theme
msgid "Gianluigi Filippelli"
msgstr ""

36
readme.txt

@ -0,0 +1,36 @@
=== Co-Authors Widget ===
Contributors: ulaulaman
Tags: widget, authors, coauthors, multi author, multiple authors
Requires at least: 4.8.5
Tested up to: 5.5.1
Requires PHP: 7.0.18
Stable tag: trunk
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
The plugin add a widget and a shortcode in order to show authors of an article. It is compatible with Co-Authors Plus, but it is not strictly required.
== Description ==
[Co-Authors Plus](https://wordpress.org/plugins/co-authors-plus/) is one of the most useful plugin for multiple authors blogs: using it you can add more than one author to your posts and you can define also guest authors without user creation. Despite this, not all themes are able to show all the authors of a post or to show the avatar of the guest author. This plugin add a widget to show users' avatars to post also for guest authors and for posts with multiple authors.
You can also add avatars using the shordcode [blog-post-coauthors].
The plugin add also a slider in order to show user's profile. If you want change the style, you can modify blog-spoiler.css file in the plugin folder.
== Installation ==
1. Extract the widget-for-coauthors.zip file and upload its contents to the /wp-content/plugins/ directory. Alternately, you can install directly from the Plugin directory within your WordPress Install.
2. Activate the plugin through the "Plugins" menu in WordPress.
3. Add the widget to your sidebar or the shortcode to your posts or pages.
== Screenshots ==
1. The result of the widget in a multiple authors post (italian language)
== Changelog ==
0.6 add author's info also in case Co-Authors Plus doesn't installed
0.5.3 add the correct lang files
0.5.2 fix error code in domain name in widget
0.5.1 fix error code in domain name for messages
0.5 support for translations
0.4 translation italian messages in english
0.3.1 test with wp 4.9.2
0.3 add profile link and css
0.2 creation of the widget to show authors' avatars
0.1 creation of the shortcode to add post's authors

157
widget-for-co-authors.php

@ -0,0 +1,157 @@
<?php
/*
Plugin Name: Co-Authors Widget Dev
Description: The plugin add a widget and a shortcode in order to show authors of an article. It is compatible with Co-Authors Plus.
Version: 0.6
Author: Gianluigi Filippelli
Author URI: http://dropseaofulaula.blogspot.it/
Plugin URI: https://github.com/ulaulaman/widget-for-co-authors
License: GPLv2 or later
*/
/* ------------------------------------------------------ */
# ---------------------------------------------------------
// Load translations
add_action('plugins_loaded', 'caw_load_translations');
function caw_load_translations() {
load_plugin_textdomain( 'widget-for-co-authors', false, dirname( plugin_basename(__FILE__) ) . '/lang/' );
}
# Shortcode to show authors
add_shortcode('blog-post-coauthors', 'blog_post_coauthors');
function blog_post_coauthors() {
return coauthors_posts_links(", ", " & ", null, null, false);
}
# Widget to show authors' avatars
function blog_avatars() {
$show_profile = __( 'Show profile', 'widget-for-co-authors' );
$hide_profile = __( 'Hide profile', 'widget-for-co-authors' );
if ( function_exists( 'get_coauthors' ) ) {
$coauthors = get_coauthors();
$user_posts = get_author_posts_url( $coauthor->ID, $coauthor->user_nicename );
$i = 0;
foreach ( $coauthors as $coauthor ) {
$i++;
?>
<div class="block-item-text">
<input type="checkbox" hidden class="read-more-state" id="<?php echo $i; ?>">
<div class="read-more-wrap">
<p><?php echo coauthors_get_avatar( $coauthor, 65 ); ?>
<a href=<?php echo get_author_posts_url( $coauthor->ID, $coauthor->user_nicename ); ?>><?php echo $coauthor->display_name; ?></a></p>
<p class="read-more-target">
<?php echo $coauthor->description; ?>
</p>
</div>
<label for="<?php echo $i; ?>" class="read-more-trigger_closed">
<strong>+ <?php printf( $show_profile ); ?></strong>
</label>
<label for="<?php echo $i; ?>" class="read-more-trigger_opened">
<strong>- <?php printf( $hide_profile ); ?></strong>
</label>
</div>
<?php
}
//
} else {
$i = 0;
?>
<div class="block-item-text">
<input type="checkbox" hidden class="read-more-state" id="<?php echo $i; ?>">
<div class="read-more-wrap">
<p><?php echo get_avatar( get_the_author_meta( 'user_email' ), 65 ); ?>
<a href=<?php echo get_the_author_meta( 'user_url' ); ?>><?php echo get_the_author_meta( 'display_name' ); ?></a></p>
<p class="read-more-target">
<?php echo get_the_author_meta( 'description' ); ?>
</p>
</div>
<label for="<?php echo $i; ?>" class="read-more-trigger_closed">
<strong>+ <?php printf( $show_profile ); ?></strong>
</label>
<label for="<?php echo $i; ?>" class="read-more-trigger_opened">
<strong>- <?php printf( $hide_profile ); ?></strong>
</label>
</div>
<?php
}
}
function blog_enqueue() {
wp_register_style( 'blog-spoiler-style', plugins_url('/blog-spoiler.css', __FILE__) );
wp_enqueue_style( 'blog-spoiler-style' );
}
add_action( 'wp_enqueue_scripts', 'blog_enqueue' );
# Shortcode authors' avatars
add_shortcode('blog-coauthors-avatars', 'blog_coauthors_avatars');
function blog_coauthors_avatars() {
return blog_avatars();
}
// Widget register
function blog_load_widget() {
register_widget( 'blog_widget' );
}
add_action( 'widgets_init', 'blog_load_widget' );
// Widget load
class blog_widget extends WP_Widget {
function __construct() {
parent::__construct(
// Widget ID
'blog_widget',
// Widget name in UI
__('Authors', 'widget-for-co-authors'),
// Widget description
array( 'description' => __( 'Show avatars and names of the authors', 'widget-for-co-authors' ), )
);
}
// Widget front-end
public function widget( $args, $instance ) {
$title = apply_filters( 'widget_title', $instance['title'] );
// before and after
echo $args['before_widget'];
if ( ! empty( $title ) )
echo $args['before_title'] . $title . $args['after_title'];
// output
blog_avatars();
echo $args['after_widget'];
}
// Widget backend
public function form( $instance ) {
if ( isset( $instance[ 'title' ] ) ) {
$title = $instance[ 'title' ];
}
else {
$title = __( 'Written by', 'widget-for-co-authors' );
}
// Widget form
?>
<p>
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
</p>
<?php
}
// Widget update
public function update( $new_instance, $old_instance ) {
$instance = array();
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
return $instance;
}
}
/* ------------------------------------------------------ */
?>
Loading…
Cancel
Save