Managing content display on the main page of the site
I'm trying to get my content set up such that the latest post always shows the full content, and the later ones only show excerpts. I've updated postformat.php with a loop as follows:
... <div class="post-bodycopy cf"> <div class="post-date"> <p class="post-month"><?php the_time( 'M' ); ?></p> <p class="post-day"><?php the_time( 'j' ); ?></p> <p class="post-year"><?php the_time( 'Y' ); ?></p> </div> <?php if (have_posts()) : $count = 0; while (have_posts()); $count++; if ($count == 1) : the_content(); else : the_excerpt(); endif; endwhile; endif; ?> </div> ... The problem here is that: 1. It's echo'ing some of the code to be rendered in the browser (count++, count ==) 2. It doesn't seem to work as expected - it renders the content in 3 sections for each post with multiple duplicate sharing buttons. It's the standard mullet loop taken from this site: http://perishablepress.com/easily-ad...oop-templates/ I'm kind of at a dead-end with it - I've tried a bunch of different formatting things, like having each line of code individually start with <?php and end with ?>, but that functioned 100% the same as the above. Is there someplace else I should be writing this code, or something with Montezuma that would prevent it from working? I'm new to Wordpress/PHP - so apologies if this is a basic error. Thanks in advance for any help. |
If you want to use more php than the limited allowed code, you need one or more plugins.
Here's what worked for me. |
Thanks Jerry. But that option won't work in the templates or sub-templates, will it? Even with the insert_php plugin activated, I'm still seeing my actual code being rendered on the page vs. the correct post content - it's actually worse because instead of just ignoring most of the PHP code when rendering, it's now rendering it all and skipping the content entirely.
Has anyone else hacked Montezuma to do this before that can share their methods? |
1) edit postformat.php and replace
HTML Code:
<?php bfa_excerpt( 55, ' ...' ); ?> HTML Code:
<?php dynamic_sidebar( 'IN LOOP' ); ?> 3) view the front page 4) go to dashboard->appearances->widgets 5) add a text widget to the 'IN LOOP' widget area 6) add the following to the text widget HTML Code:
<?php |
Thanks juggledad - that worked like a charm with one exception:
If you look at my site now (mobilechad.com), it looks like some line breaks are added such that the first paragraph isn't wrapping next to the date anymore - it's showing up underneath it. I mucked around with Firebug a little bit, but I couldn't seem to figure out what to change to get it to appear the way it used to. Also, I donated (directly to you) - I do appreciate the time you take to answer these. --mobilechad |
add the following to the end of MTO->CSS Files->clearfix.css
HTML Code:
.post-bodycopy aside.cf:before, |
Thanks - works great in Firefox but doesn't seem to work in Chrome. I'll dig around google for a while to see if I can figure out why. Thanks again!
|
?? looks fine in chrome on the mac. did you clear your cache? after all you have a caching plugin active....
|
I'm using Chrome on a Mac - cleared cache repeatedly but it makes no difference as far as I can tell. I've attached a screen grab of what I'm seeing.
|
1 Attachment(s)
odd, cause I'm on a mac and with chrome, this is what I see (Version 28.0.1500.95 of chrome osx 10.7.5)
did you clear the wsites cache since you are using a caching plugin (you should always shutoff caching plugins off when making site changes) BTW when I click on an immage it comes up BIG does not fit my screen and I'm set at 1920 x 1080. In addition there is a small white triangle about 5 1/2 inches down and 3 1/2 inches from the left edge - it is on all your photos |
I'm working on the images issue. I'm struggling to find a plug-in that does exactly what I want, and in the process of switching between a few it's left the images in a weird state with some posts working fine and some not.
|
I'm having two issues with image display on the main page that weren't a problem before I tried out the Lightbox Gallery plug-in. I've since de-activated and removed, then re-activated and removed again trying to return to the original behavior, but with no luck. I've spent about 3 hours looking around the CSS and Googling but can't seem to figure out what Lightbox has done.
Here's the problems: 1. The featured post images are now variable heights based on the original photo size vs. the standardized size Montezuma makes them, and 2. Clicking on a photo in the post itself from the main page opens a very tiny photo box (which is worse than the bug I was trying to fix when I installed Lightbox) I haven't changed any other CSS or code related to images nor do I have any other plugins installed. I'll keep plugging away but I thought I'd post this in case you'd seen it before. Thanks, Chad |
go to mto->export import and copy the export to a text file and attach it to a reply
|
Here you go
|
You need to save the export as a TEXT file, not a Word doc
|
1 Attachment(s)
Uploaded the wrong one. Here you go.
|
Please shutoff your caching plugin and flush the caches and test it again - your settings work fine for me.
|
Also the top picture on the Buyer Beware post is HUGE. It is 4000px by 3000px and over 1.5Mb. This will affect page load time and I have no idea how the caching plugin will handle it.
Is there some reason you didn't optimize and resize it for the web? |
Primarily because I'm figuring this out as I go along...
I've been uploading the photos I take unedited to Wordpress, using a plugin to optimize the file size (but not the resolution). Presumably, I want to be using a smaller res photo on featured images (and throughout), but I'm not sure of the best way to do this. When I run the optimizer it clearly shows there being multiple versions of each image in the media library at different resolutions (full, 150x150, 300x225, 1024x768). What I don't know is whether I should be: a. Simply uploading smaller res files to begin with, or b. Somehow referencing the smaller resolution for featured images (e.g. 300x225), or c. Something else entirely When I go in to edit the feature image there is an option to scale, but it looks like that scales and saves over the original image which I'd prefer not to do (unless that's the correct way?). If you guys have a suggestion for good practices here, I'd love some recos and/or implementation details. Thanks! |
I figured out the caching issue btw - I turned off the plugin but forgot about Photon, one of the components in Jetpack.
|
I generally don't have images larger than 1000px wide or 800px tall at 72DPI and 30% quality. You can use tools like Photoshop or Fotosizer or IrfanView. The last two have free versions.
|
Thanks for the suggestions. I've got a ton of photos (and am taking quite a few each day), so I grabbed a plugin to manage this for me (Imsanity). It re-scales the images to a max height/max width that I can set - automatically on upload. It looks like the weird photo issues I've been having are completely resolved at this point.
Thanks again. --Chad |
Your gallery images look like thumbnails now...
|
#&*! They didn't last night - I verified with all the caching disabled, but then turned it back on. Going to turn it off and see what happens. Thanks for letting me know.
|
All times are GMT -6. The time now is 04:19 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.