bernk
Forum Replies Created
-
Forum: Themes and Templates
In reply to: How to mark first and last post while only getting one category?Thanks Michael.
Do you have a better way to achieve this?I’ll try to describe what I’m trying to achieve a bit better, and hopefully clearer. I really need help with this as this will be my first WP theme.
The website I’m converting to use WP is https://balsi.be/home
The idea is for the WP theme to look and behave almost identical to what you see there.As you can see, there is a large header image which pertains to the most recent post, “vom Ball zum P?gg”. Each post has one associated header image with it. If I click on an older post, e.g. “Balsi gewinnt Krebsliga-Pitch” it should open that post in the single view, with that post’s header image displayed, and no other posts displayed.
The way I’ve set this up so far is to have a “news” category for posts where you write new posts and attach one image to them, not actually embed into the post but just attach. Then on the home page I get the attachment of just the most recent post and show it in the header. Make sense so far? I hope so.
This part I have achieved fully.The problem: I also need to have a category for projects. If you go to https://balsi.be/portfolio you will see what this will look like.
So, the idea is to have a page which shows a thumbnail of each project there is. For simplicities sake let’s say each project also only has one image attached, and so has a thumbnail available to us.
Then when I click on a project thumb I should be taken to a special single view for projects where I can read about the project, see the image, and jump to other projects.Please keep in mind the site I’m showing you here is NOT WordPress, it is just custom PHP/HTML.
So in summary, I need to find a way to do all of the following:
1. Display the image attached to the most recent news post on the home page.
2. Show only the posts belonging to the news category on the home page.
3. Style the last shown news post differently then the others.
4. Show only the posts belonging to the projects category on the portfolio page (or category or whatever I should be calling that)I’ve been going over the documentation a ton but I’m new to this and could really use some help.
Thank you for reading and trying to help!
Forum: Fixing WordPress
In reply to: Make sure posts only display from certain categoryHoly that was easy! Thank you : )
I’ve been trying to achieve this for the last 30 minutes.
Forum: Plugins
In reply to: Get ID of latest postHey,
I just hit a similar problem. I need to have the ID of the most recent post at my disposal. Found this thread while searching for an answer.
I just figured it out on my own! Here’s how for anyone else looking:
$newest_post_id = $posts[0]->ID
I’m not sure if this is sketchy or not, but it works!
Oops, should have checked back in here sooner! I did indeed find that bloginfo(‘template_directory’) works. There are some depricated tags though, so it makes a it a bit confusing when you find older sollutions on other sites…
Thanks anyway for all the replies!
@t31os: I don’t think a relative path works in this case because of how WP includes your template files. I think.
even though to your index.php file your images folder is in the same place, when you target an image in that folder using something like images/myphoto.jpg it won’t work.By the way, is this all I need to do in order to successfully embed Flash? Or are there some other things I need to be aware of?
I’m a total noob to WP, but I know my way around PHP ok.