[SOLVED] Pictures being linked to every post in the Blog
[SOLVED] Pictures being linked to every post in the Blog
What I mean is:
I need the main picture from every post is linked on the post card to the respective post, but I couldn't find the way to do it in the Simple Blog Plugin files.
I assume that I need a custom script to make it happens, can anyone give me a hand on this please?
Thank you.
I need the main picture from every post is linked on the post card to the respective post, but I couldn't find the way to do it in the Simple Blog Plugin files.
I assume that I need a custom script to make it happens, can anyone give me a hand on this please?
Thank you.
Last edited by StarClown on Fri Jul 11, 2025 5:35 pm, edited 1 time in total.
- NorfolkGreg
- Posts: 175
- Joined: Wed Sep 01, 2021 7:50 am
Re: I need the pictures being linked to every post in the Blog
I haven't looked at the blog plugin and whether it's that or the base template you are using, but on the assumption that every post you make will include a "main picture", I would approach the issue by editing the template to add code to make sure that every page generated includes html code that ensures that main picture will include a link.
Re: I need the pictures being linked to every post in the Blog
Hey StarClown, to show "featured picture" on post card and full post, you could add them inside post title. That is the first field when new post is created; add <img src="url-to-image"> below title:
my new post
<img src="url-to-image">
Picture will be displayed on post card and post entry. Note that the title field is wrapped inside heading 3 (h3) so it is wise to avoid adding additional tags (p, h1-h6...) but <span> does work.
Also the structure for card and entry is different if you plan to do some styling.
Post card is .post.card h3 {...}
Post entry is .post .title {...} or .post>h1 {...}
my new post
<img src="url-to-image">
Picture will be displayed on post card and post entry. Note that the title field is wrapped inside heading 3 (h3) so it is wise to avoid adding additional tags (p, h1-h6...) but <span> does work.
Also the structure for card and entry is different if you plan to do some styling.
Post card is .post.card h3 {...}
Post entry is .post .title {...} or .post>h1 {...}
Re: I need the pictures being linked to every post in the Blog
So, I did change a class.SimpleBlog.php like you seggested and nothing happens:nox wrote: Wed Jun 18, 2025 10:23 pm Hey StarClown, to show "featured picture" on post card and full post, you could add them inside post title. That is the first field when new post is created; add <img src="url-to-image"> below title:
my new post
<img src="url-to-image">
Picture will be displayed on post card and post entry. Note that the title field is wrapped inside heading 3 (h3) so it is wise to avoid adding additional tags (p, h1-h6...) but <span> does work.
Also the structure for card and entry is different if you plan to do some styling.
Post card is .post.card h3 {...}
Post entry is .post .title {...} or .post>h1 {...}
$args[0] .= <<<HTML
<div class="post card">
<h3>{$post->title}</h3>
<span><img src="url-to-image"></span>
<div class="meta">
<div class="row">
<div class="col-sm-12 text-right"></div>
</div>
</div>
<p class="description">{$post->description}</p>
<a href="{$this->Wcms->url($this->slug . '/' . $slug)}" class="text-right">↪ Learn more.</a>
</div>
Where I supposed to add that??
Also, for some weird reason, my new posts are not saving at all - only the Titles. I'm getting too frustraded with this SMS lately.
Re: I need the pictures being linked to every post in the Blog
EDIT: Editing blog post title is no longer supported for blog plugin version 3.5.0 while it worked in 3.2.4 and previous versions.
The steps below are "deprecated".
I should write more clearly from now on. Sorry for confusion.
The recommendation above is to add your images through admin panel (while logged in):
1. Upload image using Files tab, then copy image url (right click on uploaded image, copy link)
2. Create New post (New post title, OK)
3. Inside title field, after "Post title" add <img src="this-is-my-uploaded-image-url-from-files-tab"> and paste copied image url (between " ") "this-is-my-uploaded-image-url-from-files-tab"
The steps below are "deprecated".
I should write more clearly from now on. Sorry for confusion.
The recommendation above is to add your images through admin panel (while logged in):
1. Upload image using Files tab, then copy image url (right click on uploaded image, copy link)
2. Create New post (New post title, OK)
3. Inside title field, after "Post title" add <img src="this-is-my-uploaded-image-url-from-files-tab"> and paste copied image url (between " ") "this-is-my-uploaded-image-url-from-files-tab"
Re: I need the pictures being linked to every post in the Blog
Don't know if you are still looking for featured image on posts option, but I'll add minor simple blog changes future reference.
I went back to blog plugin, and for version 3.5.0 if you want to have an editable post title where an image is placed as featured image using <img> tag and uploaded images from Files under Admin area, here are steps what to do:
1. After installing Simple Blog plugin, open plugins/simple-blog/class.SimpleBlog.php with text editor
2. look for line 214: https://github.com/robiso/simple-blog/b ... g.php#L214
3. Change to and Save.
Now post title is editable and you can add image below title:
1. Upload image using Files tab (while logged in admin area), then copy uploaded image url (right click on uploaded image, copy link)
2. Create New post (New post title, OK)
3. Inside title field, after "Post title" add <img src="this-is-my-uploaded-image-url-from-files-tab.jpg"> and replace "..." with copied image link.
I went back to blog plugin, and for version 3.5.0 if you want to have an editable post title where an image is placed as featured image using <img> tag and uploaded images from Files under Admin area, here are steps what to do:
1. After installing Simple Blog plugin, open plugins/simple-blog/class.SimpleBlog.php with text editor
2. look for line 214: https://github.com/robiso/simple-blog/b ... g.php#L214
3. Change
Code: Select all
<h1 data-target="blog" style='margin-top:0;' id="title" class="title editText editable">{$post->title}</h1>Code: Select all
<div data-target="blog" style='margin-top:0;' id="title" class="title editText editable">{$post->title}</div>Now post title is editable and you can add image below title:
1. Upload image using Files tab (while logged in admin area), then copy uploaded image url (right click on uploaded image, copy link)
2. Create New post (New post title, OK)
3. Inside title field, after "Post title" add <img src="this-is-my-uploaded-image-url-from-files-tab.jpg"> and replace "..." with copied image link.
Re: I need the pictures being linked to every post in the Blog
Thank you Nox.nox wrote: Tue Jul 08, 2025 8:06 am Don't know if you are still looking for featured image on posts option, but I'll add minor simple blog changes future reference.
I went back to blog plugin, and for version 3.5.0 if you want to have an editable post title where an image is placed as featured image using <img> tag and uploaded images from Files under Admin area, here are steps what to do:
1. After installing Simple Blog plugin, open plugins/simple-blog/class.SimpleBlog.php with text editor
2. look for line 214: https://github.com/robiso/simple-blog/b ... g.php#L214
3. ChangetoCode: Select all
<h1 data-target="blog" style='margin-top:0;' id="title" class="title editText editable">{$post->title}</h1>and Save.Code: Select all
<div data-target="blog" style='margin-top:0;' id="title" class="title editText editable">{$post->title}</div>
Now post title is editable and you can add image below title:
1. Upload image using Files tab (while logged in admin area), then copy uploaded image url (right click on uploaded image, copy link)
2. Create New post (New post title, OK)
3. Inside title field, after "Post title" add <img src="this-is-my-uploaded-image-url-from-files-tab.jpg"> and replace "..." with copied image link.
That's exactly what I was doing in the first place. But I was looking to link the picture with the actual post, you know, like any other blog where you just need to click on the picture to see the whole post.
Anyhow, what it's bothering now is that NONE of my NEW POSTS are getting save. No clue what's going on but the only thing that it's showing is THE TITLE, nothing more. The keywords or content doesn't show at all.
ANY THOUGHTS ABOUT THIS ISSUE PLEASE??
Re: I need the pictures being linked to every post in the Blog
Hey StarClown, you did this change to class.Simple.Blog.php:
I would do a backup of Blog database (data/simpleblog.json) first.
Then you could just replace class.Simple.Blog.php with original file from github: https://github.com/robiso/simple-blog/tree/master
Download class.Simple.Blog.php from github and upload to plugins/simple-blog.
Edit h1 to div, reference line 214: https://github.com/robiso/simple-blog/b ... g.php#L214
<h1 data-target="blog" style='margin-top:0;' id="title" class="title editText editable">{$post->title}</h1>
Did you revert it back to original?StarClown wrote: Fri Jun 27, 2025 8:46 pm So, I did change a class.SimpleBlog.php like you seggested and nothing happens:
$args[0] .= <<<HTML
<div class="post card">
<h3>{$post->title}</h3>
<span><img src="url-to-image"></span>
<div class="meta">
<div class="row">
<div class="col-sm-12 text-right"></div>
</div>
</div>
<p class="description">{$post->description}</p>
<a href="{$this->Wcms->url($this->slug . '/' . $slug)}" class="text-right">↪ Learn more.</a>
</div>
Where I supposed to add that??
Also, for some weird reason, my new posts are not saving at all - only the Titles. I'm getting too frustraded with this SMS lately.![]()
I would do a backup of Blog database (data/simpleblog.json) first.
Then you could just replace class.Simple.Blog.php with original file from github: https://github.com/robiso/simple-blog/tree/master
Download class.Simple.Blog.php from github and upload to plugins/simple-blog.
Edit h1 to div, reference line 214: https://github.com/robiso/simple-blog/b ... g.php#L214
<h1 data-target="blog" style='margin-top:0;' id="title" class="title editText editable">{$post->title}</h1>
Last edited by nox on Thu Jul 10, 2025 9:16 pm, edited 2 times in total.
Re: I need the pictures being linked to every post in the Blog
For adding post card image link to a single post, you could add link to title and image (because image is inside the post title) editing class.SimpleBlog.php.
Look for<h3>{$post->title}</h3> inside class.Simple.Blog.php (line 190):
https://github.com/robiso/simple-blog/b ... g.php#L190
and apply Read more permalink to it, so it will look like this:
Look for<h3>{$post->title}</h3> inside class.Simple.Blog.php (line 190):
https://github.com/robiso/simple-blog/b ... g.php#L190
and apply Read more permalink to it, so it will look like this:
Code: Select all
<h3><a href="{$this->Wcms->url($this->slug . '/' . $slug)}">{$post->title}</a></h3>Re: I need the pictures being linked to every post in the Blog
Once again, thank you Nox. This works just fine!nox wrote: Thu Jul 10, 2025 9:11 pm For adding post card image link to a single post, you could add link to title and image (because image is inside the post title) editing class.SimpleBlog.php.
Look for<h3>{$post->title}</h3> inside class.Simple.Blog.php (line 190):
https://github.com/robiso/simple-blog/b ... g.php#L190
and apply Read more permalink to it, so it will look like this:Code: Select all
<h3><a href="{$this->Wcms->url($this->slug . '/' . $slug)}">{$post->title}</a></h3>