M.O.R.E.
El Presidente
Just Getting Started
Member Likes (0)
Hi
My posts are not fetching featured image....I have published pages using "blognews template" what could be the problem?
Found this snippet...can I use it in my child theme's function.php code....will it help in anyway
function autoset_featured() {
global $post;
$already_has_thumb = has_post_thumbnail($post->ID);
if (!$already_has_thumb) {
$attached_image = get_children( "post_parent=$post->ID&post_type=attachment&post_mime_type=image&numberposts=1" );
if ($attached_image) {
foreach ($attached_image as $attachment_id => $attachment) {
set_post_thumbnail($post->ID, $attachment_id);
}
}
}
} //end function
add_action('the_post', 'autoset_featured');
add_action('save_post', 'autoset_featured');
add_action('draft_to_publish', 'autoset_featured');
add_action('new_to_publish', 'autoset_featured');
add_action('pending_to_publish', 'autoset_featured');
add_action('future_to_publish', 'autoset_featured');

Responses (28)
Member (joined January 2012) Likes (0)
Oh...the sample image....
Support Kangaroo (joined March 2011) Likes (0)
Greetings M.O.R.E.,
Thank you for being a WPMU Dev member!
OK you have indicated you are using the Blog News template and that you have an image problem being incorporated into your posts.
Which short code are you using to display your products?
Cheers, Joe :-)
Member (joined January 2012) Likes (0)
Hi aecnu
Thanks for responding so fast.....I somehow managed to get the thumbnails on the list page (moretique.com/blogs/)...by inserting this line in the blognews template
but failing to show the image on the main post....I am not using any shortcode as such
Thanks
Member (joined January 2012) Likes (0)
Hi
Please guide me someone how do I correct this image fetching problem.....the blognews template is not showing any image
Thanks
Member (joined January 2012) Likes (0)
HEllo!!
Please guide me someone how do I correct this image fetching problem.....the blognews template is not showing any image
Thanks
DEV Diva (joined February 2012) Likes (0)
Hi M.O.R.E.
Greetings from the WPMU DEV Team!
Further to your requests above, I've flagged the Developer for feedback. Unfortunately I am not too sure how to achieve the style you're looking for and would rather leave that to the experts.
I understand your frustration in trying to get this resolved, but I would appreciate it if you allow us some time to get back to you with feedback / or a solution.
And if you require any further assistance with any other topic/ plugin, please don't hesitate to be in touch.
Gina :: Multiplicity
Trying out as WPMU DEV Support Staff - Let me know how I go
Theme Designer (joined November 2009) Likes (0)
Hi, looking at this thread it seems you are using custom code in that template. This probably is the issue as the feature image should just appear in the blog / news template if you use the default (no added code) feature image option in the post edit.
What I am going to do is get our Support lead in here to give you some eyeballs on the custom code and his thoughts.
Member (joined January 2012) Likes (0)
Thanks everybody
I am using only the above mentioned code in blognews template to fetch the thumbnail and nothing else
The images are not displaying onto the page from the very beginning...I've created one page gave it a title "Blog" and selected the BlogNews Template....that's it....it's showing images when gets inserted in post but it should also fetch the featured image and show it like it's happening with MP products
Sorry for constantly bugging like this
:-)
DEV Diva (joined February 2012) Likes (0)
Hi M.O.R.E.
You're definitely not bugging us :) It's a pleasure to try and assist, and of course, that's what we're here for.
I will ask the Developer, Tammie to pitch in, because I'm not too sure how the code you're using will affect the Theme design. And she's the expert after all :)
(I will play around on a test installation and see if I can find any answers, but I'm more a visual type of gal, so lots of code just gets my head spinning.)
Will be on standby for any further feedback from Tammie or you.
Have a good day!
Gina :: Multiplicity
Trying out as WPMU DEV Support Staff - Let me know how I go
Theme Designer (joined November 2009) Likes (0)
As said lets get Mason's input but you should be calling a featured post thumbnail like this:
Member (joined January 2012) Likes (0)
:-)
No it seems it's not working.....removed the earlier code
Replaced with your code it started fetching images in actual size......and still no image in details post. Please see the screenshots
Thanks a ton.
Member (joined January 2012) Likes (0)
Gina I'm also a visual person....building my site piece-by-piece with trial and error method....don't understand most of the stuff....eagerly reading everything the team discusses with others in this forum...which I must say is a storehouse of information....apparently this is my first website in wordpress...thought of giving it a try when my coder left (who did my other sites)...and I'm determined to build it no matter what it takes...and all with support from you wonderful people......:-)
Member (joined April 2009) Likes (0)
Hiya M.O.R.E.,
There's several ways to tackle this one actually. As you're creating a child theme of FrameMarket (nice work by the way) you may want to look at another one of our themes, SimpleMarket:
http://premium.wpmudev.org/project/simplemarket
It is also a child-theme of FrameMarket and provides for a featured thumbnail image in the Blog template by default. Check out the code in template-blog.php and in content.php for how this is accomplished.
You seem to already have code that is working for you in creating thumbnails on the blog template though. If that's working for you then terrific!
To get the featured thumbnail to display on an individual post, you'll also need to add the code to your child theme's single.php file.
You can do this in the same way by calling:
<?php the_post_thumbnail();?>I'd also note that you can easily define the size by using one of your 3 preset thumbnail sizes (as set in Settings > Media) for your featured image, or you can dictate a new size altogether. You’ll change the thumbnail call according to which size you want it:
Large
<?php the_post_thumbnail('large');?>Medium
<?php the_post_thumbnail('medium');?>Thumbnail
<?php the_post_thumbnail('thumbnail');?>Custom size
<?php the_post_thumbnail( array (width,height) );?>For the custom size, replace width and height with the number of pixels that each length should be. For example, to show an image 300 pixels wide and 200 pixels high, use:
<?php the_post_thumbnail( array (300,200) );?>Hope this helps a bit. Just make sure the above code exists inside the loop on your single.php page (or content-single.php if you're following the SimpleMarket example) and you'll be good to go.
Thanks!
Member (joined January 2012) Likes (0)
Thank you, Thank you Aecnu, GinaB, Tammie, Masonjames and others....finally its sorted...only wish to know how do I control it's appearence....right now its appearing in this order
Image > title > meta > text > comment box
But want to display in this order
1) Title
2) Image
3) Text
4) Meta & other details
This is the order in single.php how do I change the order? Or do I have to do it in template-blognews.php
Thanks once again
Member (joined January 2012) Likes (0)
Would also love to include
1) an "avatar" of the person along with name (which is there now) who is posting that article/news....
2) caption under the image
3) and 4 related item's (image and small text)
if I use custom field I do have to assign a place for that in the single.php ...how can I call that? And where should I post the code?
Thanks
Member (joined January 2012) Likes (0)
It seems the code is not displaying properly
Member (joined January 2012) Likes (0)
Somehow it got missed...so re-posting it.....any advice appreciated....the issue is
Where can I post a code like this for fetching (underneath the image)
1) an "avatar" of the person along with name (which is there now) who is posting that article/news....
2) caption under the image
3) and 4 related item's (image and small text)
if I use custom field I do have to assign a place for that in the single.php ...how can I call that? And where should I post the code (if this is the right code that is)?
Thanks
Member (joined January 2012) Likes (0)
This also got missed....can anyone help me on this please
I wish to know how do I control it's appearence....right now its appearing in this order
Image > title > meta > text > comment box
But want to display in this order
1) Title
2) Image
3) Text
4) Meta & other details
This is the order in single.php how do I change the order? Or do I have to do it in template-blognews.php
<?php get_header(); ?>
<div id="content">
<?php if($bp_existed == 'true') : ?>
<?php do_action( 'bp_before_blog_single_post' ) ?>
<?php endif; ?>
<?php the_post_thumbnail();?>
<?php get_template_part( 'content', 'single' ); ?>
<?php if($bp_existed == 'true') : ?>
<?php do_action( 'bp_after_blog_single_post' ) ?>
<?php endif; ?>
</div>
<?php get_sidebar(); ?>
<?php get_footer() ?>
Thanks once again
Support Kangaroo (joined March 2011) Likes (0)
Greetings M.O.R.E.,
Your not being missed, unfortunately Mason has been out ill for awhile and I happened to stumble upon your thread buried in the support system. I will try to be of assistance.
Please advise what the results show with this small change. I moved the thumbnail code up three lines.
Cheers, Joe :-)
Support Kangaroo (joined March 2011) Likes (0)
Greetings M.O.R.E.,
We have not heard back from you in sometime regarding this ticket.
As a housekeeping measure I am marking it resolved.
However, if you are still having an issue related to this thread please check mark below as not resolved (or we may miss it) and we will get back to it asap.
please include and new developments if any by posting them below.
Cheers, Joe :-)
Member (joined January 2012) Likes (0)
Hi Joe......I tried but it didn't work....sending you the screenshots please have a look......do I need to create a new template and single.php file with custom code?
Thanks anyways
DEV Diva (joined February 2012) Likes (0)
Hi M.O.R.E
Hope you're well.
I've been following this thread and am glad for the assistance provided by our Senior Support Team.
Now from your last screenshots and requirements mentioned on it, I believe that it's only the code that needs to be reshuffled and of course a bit of customization for the spacing that you want after Meta and Post.
Can I have a look at your code for this page again? If it is too long (more than 10 lines), then just add it to pastebin.com and send the link for the code to me.
I'm sure we can get it sorted for you.
Have a good day and waiting for your feedback.
GinaB
Member (joined January 2012) Likes (0)
Hi GinaB....thank you...and here's the code for the single.php page
DEV Diva (joined February 2012) Likes (0)
Goodie! Let me see what I can do with it, thank you M.O.R.E.
I will revert back to you at the earliest, hopefully with a solution for you.
Have a good day and talk soon.
GinaB
Member (joined April 2009) Likes (0)
Hiya MORE,
This is a bit more complex of customization (as you've noticed :D)
The tricky part is this line:
<?php get_template_part( 'content', 'single' ); ?>That line is pulling in content-single.php (in your theme's root) and display it's content in a specific order.
So your options are to edit your content-single.php file (which will effect the order for all post types) or you can make a copy of content-single.php with a new title like content-product.php for example.
Then change the part in your file above to read:
<?php get_template_part( 'content', 'product' ); ?>
Now you can edit content-product to move the title and other elements around. Note: you'll need to move the_post_thumbnail portion into the new file in order to get it to appear below the title.
There's several other ways to do it (you could just copy all the content-product.php in your main file in place of the get_template_part line.
Hope this helps. It's a customization that goes a bit beyond what we can actually code for you hear in the forums. A little trial and error though, and I bet you can get there.
Thanks!
DEV Diva (joined February 2012) Likes (0)
@Mason
Thank you for the great feedback and suggestions to M.O.R.E. I've been investigating and researching on what solution I could offer, but nothing came up.
@M.O.R.E.
As Mason pointed out, this is more customized coding and a bit beyond the scope that we support here in the forum. I was going through PHP e-books and even asking PHP developers for possible solutions and I couldn't come up with a solution. It seems it is a simple matter of trial and error.
Hope you get sorted. I tried :)
Have a good day.
GinaB
Member (joined January 2012) Likes (0)
Thank you. Thank you.....will try as Mason pointed out...I'm a bit slow learner....:-) but a good student...will manage somehow....and Gina may bother you again with my dumbest of queries...:-p
DEV Diva (joined February 2012) Likes (0)
@M.O.R.E.
No matter how small your question, we are here to support you. And we will always try our best to find a solution for you.
Have a good day and talk soon :P
Gina
Become a member