| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | Mark Forums Read | User manuals | Login |
Blog System: Include an image in the home page section | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Blog System: Include an image in the home page section
Hi all
I am using the XC Blog System plugin for WordPress, which displays excerpts of the latest blog posts on my home page. By default, those posts are displayed in a fairly unattractive manner, so to try and jazz it up a little, so I have created a module and AWidget.php file with a version of the getHTMLContentWidget() function. Because of the way this function displays the posts, I don't believe it is possible to do what I want through CSS alone. Although my design skills are a bit rubbish, my module seems to be working, and I can modify the display of posts as I see fit through this function backed up with CSS. I would like to include the post image in this display too, but as far as I am aware, the image is not available by default. There is certainly no reference to it in the function I am tinkering with, and I don't know how to get it, but I assume it is not part of the data query for the posts. If you have done this already, or you happen to know how it can be done, can you give me some pointers? I can muddle through most things once I have a basic understanding, but I am not a php programmer. Keeping it simple would be extremely helpful. Many thanks Welly |
|||||||
#2
|
|||||||||
|
|||||||||
Re: Blog System: Include an image in the home page section
Hi Welly,
I have just tried to create a blog post with the featured image and this featured image is already displayed alongside the post like this: https://www.awesomescreenshot.com/image/3887474/324fb1774dbd2714f3254193592400b1 Could you please let me know what kind of image is not yet displayed, but it should be? Thank you. Tony
__________________
Found a bug in X-Cart? Post it to our bug tracker! Know how to make X-Cart better? Suggest an idea! |
|||||||||
#3
|
|||||||
|
|||||||
Re: Blog System: Include an image in the home page section
Hi Tony
Many thanks for your reply. In the blog page itself, the header images are displayed perfectly. I think that is what your image is showing. However, I have the content section enabled on my home page, and this content section does not display an image. It only displays, and can only display (as far as I can tell), the heading, the excerpt, and the author for the last few posts. For every post excerpt I display on my home page, I want to also display the corresponding header image. I have attached two images. One shows what I created in XC4 using xCMS (Smack Digital), and the other shows what I have done so far with XC5 and the Blog System module. Formatting and layout aside, you can see that in the XC4 version, each post shows the image, and that is what I want to create in XC5. I just don't know how to obtain the image so that I can display and style it. EDIT: Somehow my image names are incorrect - the one that shows the images is in XC4, and the one without is XC5. Clever of me... Many thanks Welly |
|||||||
#4
|
|||||||||
|
|||||||||
Re: Blog System: Include an image in the home page section
Hi @welly,
As far as I can see, you can pull post's image from WP using the 'get_the_post_thumbnail' method: https://developer.wordpress.org/reference/functions/get_the_post_thumbnail/ In that sense, you can edit Code:
I have just quickly tried to replace this piece of code: Code:
with the next one: Code:
and it has kind of worked out. Let me know if you need any further help. Tony Quote:
__________________
Found a bug in X-Cart? Post it to our bug tracker! Know how to make X-Cart better? Suggest an idea! |
|||||||||
#5
|
|||||||
|
|||||||
Re: Blog System: Include an image in the home page section
Hi Tony
Yes, I think this will do the trick. That function gets the post 'Featured Image', which I haven't used so far, but it does work. I just need to place the image and finesse it with css, and we should be good to go. Many thanks Welly |
|||||||
|
Thread Tools | Search this Thread |
|
|
|
|||
X-Cart forums © 2001-2020
|