[SOLVED] Pictures being linked to every post in the Blog

Ask for help or provide support to other members.
Post Reply
StarClown
Posts: 8
Joined: Tue Jun 03, 2025 6:01 am

[SOLVED] Pictures being linked to every post in the Blog

Post by StarClown »

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.
Last edited by StarClown on Fri Jul 11, 2025 5:35 pm, edited 1 time in total.
User avatar
NorfolkGreg
Posts: 175
Joined: Wed Sep 01, 2021 7:50 am

Re: I need the pictures being linked to every post in the Blog

Post by NorfolkGreg »

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.
User avatar
nox
Posts: 84
Joined: Sat May 23, 2020 9:02 pm

Re: I need the pictures being linked to every post in the Blog

Post by nox »

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 {...}
StarClown
Posts: 8
Joined: Tue Jun 03, 2025 6:01 am

Re: I need the pictures being linked to every post in the Blog

Post by StarClown »

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 {...}
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">&#8618; 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. :roll:
User avatar
nox
Posts: 84
Joined: Sat May 23, 2020 9:02 pm

Re: I need the pictures being linked to every post in the Blog

Post by nox »

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"
User avatar
nox
Posts: 84
Joined: Sat May 23, 2020 9:02 pm

Re: I need the pictures being linked to every post in the Blog

Post by nox »

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

Code: Select all

<h1 data-target="blog" style='margin-top:0;' id="title" class="title editText editable">{$post->title}</h1>
to

Code: Select all

<div data-target="blog" style='margin-top:0;' id="title" class="title editText editable">{$post->title}</div>
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.
StarClown
Posts: 8
Joined: Tue Jun 03, 2025 6:01 am

Re: I need the pictures being linked to every post in the Blog

Post by StarClown »

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. Change

Code: Select all

<h1 data-target="blog" style='margin-top:0;' id="title" class="title editText editable">{$post->title}</h1>
to

Code: Select all

<div data-target="blog" style='margin-top:0;' id="title" class="title editText editable">{$post->title}</div>
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.
Thank you Nox.

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?? :shock:
User avatar
nox
Posts: 84
Joined: Sat May 23, 2020 9:02 pm

Re: I need the pictures being linked to every post in the Blog

Post by nox »

Hey StarClown, you did this change to class.Simple.Blog.php:
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">&#8618; 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. :roll:
Did you revert it back to original?

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.
User avatar
nox
Posts: 84
Joined: Sat May 23, 2020 9:02 pm

Re: I need the pictures being linked to every post in the Blog

Post by nox »

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>
StarClown
Posts: 8
Joined: Tue Jun 03, 2025 6:01 am

Re: I need the pictures being linked to every post in the Blog

Post by StarClown »

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>
Once again, thank you Nox. This works just fine!

;)
Post Reply