How to : Latest post filter tags?
- Edi
- Site Admin
- Posts: 3069
- Joined: Sun Aug 09, 2015 5:01 pm
- Location: Zurich
- Has thanked: 68 times
- Been thanked: 99 times
- Contact:
The plugin shows the latest or newest posts. "Plugin label" means the title of the section with the list of the latest posts shown in the frontend.mahmut wrote:LATEST_POSTS recent issues with plug-in may filter according to the specified label ? How can I do it?
Thank you. So I want to add that extension profile picture . But I get the following error . What could be the reason? Thank you.Edi wrote:The plugin shows the latest or newest posts. "Plugin label" means the title of the section with the list of the latest posts shown in the frontend.mahmut wrote:LATEST_POSTS recent issues with plug-in may filter according to the specified label ? How can I do it?
Edit // + I would also like to add the image thumbnail .
Error messagge:
Code: Select all
Fatal error: Call to a member function profilePicture() on null in C:\xampp\htdocs\bl-plugins\latest_posts\plugin.php on line 54
Code: Select all
$html .= '<a href="'.$Post->permalink().'" class="author"><img src="'.$User->profilePicture().'" alt="" /></a>';
- Edi
- Site Admin
- Posts: 3069
- Joined: Sun Aug 09, 2015 5:01 pm
- Location: Zurich
- Has thanked: 68 times
- Been thanked: 99 times
- Contact:
Where do you like to add it?mahmut wrote: So I want to add that extension profile picture . But I get the following error . What could be the reason? Thank you.
Edit // + I would also like to add the image thumbnail .
Thanks.Edi wrote:Where do you like to add it?mahmut wrote: So I want to add that extension profile picture . But I get the following error . What could be the reason? Thank you.
Edit // + I would also like to add the image thumbnail .
Latest post plugin.
Example:

My code:
Code: Select all
foreach($posts as $Post)
{
$html .= '<article class="mini-post">'.PHP_EOL;
$html .= ' <header>'.PHP_EOL;
$html .= ' <h3><a href="'.$Post->permalink().'" title="'.$Post->title().'">'.$Post->title().'</a></h3>'.PHP_EOL;
$html .= ' <time class="published" datetime="">'.$Post->date().'</time>'.PHP_EOL;
$html .= ' <a href="'.$Post->permalink().'" class="author"><img src="" title="" alt="" /></a>'.PHP_EOL;
$html .= ' </header>'.PHP_EOL;
$html .= ' <a href="'.$Post->permalink().'" class="image"><img src="'.$Post->coverImage().'" alt="'.$Post->title().'" title="'.$Post->title().'" /></a>'.PHP_EOL;
$html .= '</article>'.PHP_EOL;
}
2. Add author profile photo
3. To writing the date of Turkish
Thanks.
Latest post plugin full code:
Code: Select all
<?php
class pluginLatestPosts extends Plugin {
public function init()
{
$this->dbFields = array(
'label'=>'Başlıca konular',
'amount'=>5
);
}
public function form()
{
global $Language;
$html = '<div>';
$html .= '<label>'.$Language->get('Plugin label').'</label>';
$html .= '<input name="label" id="jslabel" type="text" value="'.$this->getDbField('label').'">';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$Language->get('Amount of posts').'</label>';
$html .= '<input name="amount" id="jsamount" type="text" value="'.$this->getDbField('amount').'">';
$html .= '</div>';
return $html;
}
public function SideIki()
{
$posts = buildPostsForPage(0, $this->getDbField('amount'), true, false);
$html = '<div class="plugin plugin-baslica-konular">'.PHP_EOL;
$label = $this->getDbField('label');
if( !empty($label) ) {
$html .= ' <h2 class="plugin-baslik">'.$label.'</h2>'.PHP_EOL;
}
$html .= '<div class="plugin-content">'.PHP_EOL;
$html .= ' <section>'.PHP_EOL;
$html .= ' <div class="mini-posts">'.PHP_EOL;
foreach($posts as $Post)
{
$html .= '<article class="mini-post">'.PHP_EOL;
$html .= ' <header>'.PHP_EOL;
$html .= ' <h3><a href="'.$Post->permalink().'" title="'.$Post->title().'">'.$Post->title().'</a></h3>'.PHP_EOL;
$html .= ' <time class="published" datetime="">'.$Post->date().'</time>'.PHP_EOL;
$html .= ' <a href="'.$Post->permalink().'" class="author"><img src="author photo????" title="" alt="" /></a>'.PHP_EOL;
$html .= ' </header>'.PHP_EOL;
$html .= ' <a href="'.$Post->permalink().'" class="image"><img src="thubmanil image??" alt="'.$Post->title().'" title="'.$Post->title().'" /></a>'.PHP_EOL;
$html .= '</article>'.PHP_EOL;
}
$html .= '</div>'.PHP_EOL;
$html .= '</section>'.PHP_EOL;
$html .= '</div>'.PHP_EOL;
$html .= '</div>'.PHP_EOL;
return $html;
}
}
- Edi
- Site Admin
- Posts: 3069
- Joined: Sun Aug 09, 2015 5:01 pm
- Location: Zurich
- Has thanked: 68 times
- Been thanked: 99 times
- Contact:
Step by step... There are some modifications necessary.
First the cover image. Basically the following works for cover images as part of the latest posts (it's a slight modification of the plugin).
At the moment it's better to use the image instead of the thumbnail. Beside the thumbnail is always shown as square it's size is greater than the one of the image (this has to be fixed).
It makes no sense to use the semantical tag <article> in a sidebar. It should be used only for the main content of a post or page or for comments:
http://www.w3schools.com/tags/tag_article.asp
https://developer.mozilla.org/en-US/doc ... nt/article
First the cover image. Basically the following works for cover images as part of the latest posts (it's a slight modification of the plugin).
Code: Select all
foreach($posts as $Post)
{
$html .= '<li>';
if($Post->coverImage()) {
$html .= '<a href="'.$Post->permalink().'"><img src="'.$Post->coverImage().'" alt="Cover Image"></a>';
}
$html .= '<a href="'.$Post->permalink().'">'.$Post->title().'</a>';
$html .= '</li>';
}
It makes no sense to use the semantical tag <article> in a sidebar. It should be used only for the main content of a post or page or for comments:
http://www.w3schools.com/tags/tag_article.asp
https://developer.mozilla.org/en-US/doc ... nt/article
Thanks, okay.
I wanted to add thumbnail for page opening speed.
So how do I make the user profile picture, and date settings ?
I wanted to add thumbnail for page opening speed.
So how do I make the user profile picture, and date settings ?
Edi wrote:Step by step... There are some modifications necessary.
First the cover image. Basically the following works for cover images as part of the latest posts (it's a slight modification of the plugin).
At the moment it's better to use the image instead of the thumbnail. Beside the thumbnail is always shown as square it's size is greater than the one of the image (this has to be fixed).Code: Select all
foreach($posts as $Post) { $html .= '<li>'; if($Post->coverImage()) { $html .= '<a href="'.$Post->permalink().'"><img src="'.$Post->coverImage().'" alt="Cover Image"></a>'; } $html .= '<a href="'.$Post->permalink().'">'.$Post->title().'</a>'; $html .= '</li>'; }
It makes no sense to use the semantical tag <article> in a sidebar. It should be used only for the main content of a post or page or for comments:
http://www.w3schools.com/tags/tag_article.asp
https://developer.mozilla.org/en-US/doc ... nt/article
- Edi
- Site Admin
- Posts: 3069
- Joined: Sun Aug 09, 2015 5:01 pm
- Location: Zurich
- Has thanked: 68 times
- Been thanked: 99 times
- Contact:
Next step. the image of the author.
Code: Select all
foreach($posts as $Post)
{
$User = $Post->user();
$html .= '<li>';
if($Post->coverImage()) {
$html .= '<a href="'.$Post->permalink().'"><img src="'.$Post->coverImage().'" alt="Cover Image"></a>';
}
$html .= '<a href="'.$Post->permalink().'">'.$Post->title().'</a>';
if($User->profilePicture()) {
$html .= '<div class="author"><img src="'.$User->profilePicture().'" alt=""></div>';
}
$html .= '</li>';
}
- Edi
- Site Admin
- Posts: 3069
- Joined: Sun Aug 09, 2015 5:01 pm
- Location: Zurich
- Has thanked: 68 times
- Been thanked: 99 times
- Contact:
Next step the date as explained earlier at Post date time language change?.
Missing is only the styling with CSS.
Code: Select all
foreach($posts as $Post)
{
$User = $Post->user();
// Local month
$nmeng = array('January','February','March','April','May','June','July','August','September','October','November','December');
$nmger = array('Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember');
$dt = $Post->date();
$dt = str_ireplace($nmeng, $nmger, $dt);
$html .= '<li>';
if($Post->coverImage()) {
$html .= '<a href="'.$Post->permalink().'"><img src="'.$Post->coverImage().'" alt="Cover Image"></a>';
}
$html .= '<a href="'.$Post->permalink().'">'.$Post->title().'</a>';
$html .= '<time class="published" datetime="2015-11-01">'.$dt.'</time>';
if($User->profilePicture()) {
$html .= '<div class="author"><img src="'.$User->profilePicture().'" alt=""></div>';
}
$html .= '</li>';
}
Thank you very, very much . I love you Edi! 
Thumbnail additions are not we ? If not, no problem , thank you.

Thumbnail additions are not we ? If not, no problem , thank you.
Edi wrote:Next step the date as explained earlier at Post date time language change?.
Missing is only the styling with CSS.Code: Select all
foreach($posts as $Post) { $User = $Post->user(); // Local month $nmeng = array('January','February','March','April','May','June','July','August','September','October','November','December'); $nmger = array('Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'); $dt = $Post->date(); $dt = str_ireplace($nmeng, $nmger, $dt); $html .= '<li>'; if($Post->coverImage()) { $html .= '<a href="'.$Post->permalink().'"><img src="'.$Post->coverImage().'" alt="Cover Image"></a>'; } $html .= '<a href="'.$Post->permalink().'">'.$Post->title().'</a>'; $html .= '<time class="published" datetime="2015-11-01">'.$dt.'</time>'; if($User->profilePicture()) { $html .= '<div class="author"><img src="'.$User->profilePicture().'" alt=""></div>'; } $html .= '</li>'; }