Websites and Blogs

Discuss everything related to website and blog registration, hosting, and development.

Forum Sponsor (Advertise with us)
Reply
 
Thread Tools Display Modes
    #1 (permalink)  
Old 08-28-2012
ChristinaVOS's Avatar
Active Member
Company name: Christina Nelson ~ Life & Biz Alchemist
 
Join Date: Nov 2007
Location: Upstate NY
Posts: 984
Send a message via AIM to ChristinaVOS Send a message via Skype™ to ChristinaVOS
Follow this virtual assistant on Twitter Find this virtual assistant on Facebook Contact this virtual assistant on LinkedIn Find this virtual assistant on Google+
Default Stuck on this chunk of WP code- Help
I have been going crazy trying to figure this out and the theme developer is absolutely no help. Waited a week for him to say he wouldn't help.

I have this code:
PHP Code:
 <?php
        $loop 
= new WP_Query( array( 'post_type' => 'post''posts_per_page' => 6'paged' => $paged ) );
        echo 
'<div id="ajax-container"><div id="ajax-inner">';
        while ( 
$loop->have_posts() ) : $loop->the_post(); ?>
            <div class="blog-post">
            <div class="featuredImageHolder">

                <?php if ( has_post_thumbnail() ) the_post_thumbnail'full', array( 'class' => "featuredImage", ) ); ?>
                <div class="justBlogHolder">
                    <div class="blog_title">
                        <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
                        <p class="blog_excerpt"><?php echo the_excerpt(); ?></p>
                        <a class="blog-icon" href="<?php the_permalink(); ?>"> Read More &raquo; </a>
                    </div>
                </div>

                <div class="blog_metainfo">
                     </div>
                </div>
            </div>

        <?php endwhile; ?>
That code shows a large image(featured image) on the archive page of the blog, with the title and an excerpt overlay for each post.
I need to know what I can change to make it grab just the title (and the excerpt if possible) if there is no featured image chosen.

The blog was moved from blogger so all images are in the posts (over 300 of them) but none are considered "attached" in WP.

We are slowly going through adding the featured images but need this workaround while we do.

Thanks,
~C
__________________
~Christina
Reply With Quote
    #2 (permalink)  
Old 08-28-2012
burneyvoa's Avatar
Junior Member
Company name: An Office Extension, LLC
 
Join Date: Mar 2011
Location: Midwest, Ohio
Posts: 395
Blog Entries: 1
Send a message via Skype™ to burneyvoa
Follow this virtual assistant on Twitter Find this virtual assistant on Facebook Contact this virtual assistant on LinkedIn
Default Re: Stuck on this chunk of WP code- Help
I would love to be able to help you this time, Christina, but, as you know, I am still in the learning stages of WP. I am sure there is someone on the forums who can give you the needed advice.
Wendy Burney
__________________
http://www.anofcextension.com
EHR implementation/support, Computer software training, Medical Billing and Coding
Reply With Quote
    #3 (permalink)  
Old 08-28-2012
virtual writing's Avatar
Resident Member
Company name: Virtual Writing and Communications
 
Join Date: Nov 2007
Location: Alamance County, NC
Posts: 1,427
Blog Entries: 1
Follow this virtual assistant on Twitter Contact this virtual assistant on LinkedIn
Default Re: Stuck on this chunk of WP code- Help
Errrr .... Would something like this help?

<?php
$loop = new WP_Query( array( 'post_type' => 'post', 'posts_per_page' => 6, 'paged' => $paged ) );
echo '<div id="ajax-container"><div id="ajax-inner">';
while ( $loop->have_posts() ) : $loop->the_post(); ?>
<div class="blog-post">
<div class="blog_title">
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<p class="blog_excerpt"><?php echo the_excerpt(); ?></p>
<a class="blog-icon" href="<?php the_permalink(); ?>"> Read More &raquo; </a>
</div>


//php if/then statement to determine if there is a featuredImage//


<div class="featuredImageHolder">

<?php if ( has_post_thumbnail() ) the_post_thumbnail( 'full', array( 'class' => "featuredImage", ) ); ?>
<div class="justBlogHolder">

</div>

<div class="blog_metainfo">
</div>
</div>
</div>

<?php endwhile; ?>



.... which is obviously not complete, but I'm suggesting making the process dependent on the title, rather than the image ...

Make any sense?

(Just digging the adventure, here!)
__________________
Mary H. Ruth/Virtual Writing & Communications
http://www.writingVA.com
Reply With Quote
    #4 (permalink)  
Old 08-28-2012
LeeDrozak's Avatar
Community Leader
Company name: Lee Drozak Biz
 
Join Date: Aug 2008
Location: Western Pennsylvania
Posts: 3,302
Blog Entries: 13
Send a message via Skype™ to LeeDrozak
Follow this virtual assistant on Twitter Find this virtual assistant on Facebook Contact this virtual assistant on LinkedIn Find this virtual assistant on Google+ Find this virtual assistant on YouTube
Default Re: Stuck on this chunk of WP code- Help
Don't know if you still need help with this but a good work around for pulling featured image from post is:

Put in your functions.php file and your theme automatically sets it to the first available image


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');


Hope this helps.
__________________
Lee Drozak
WHY GO IT ALONE?... I am here to help you get unstuck.
Reply With Quote
    #5 (permalink)  
Old 08-29-2012
Contributing Member
Company name: TinaTheVA
 
Join Date: Jun 2012
Location: Metro Atlanta, GA
Posts: 171
Follow this virtual assistant on Twitter
Default Re: Stuck on this chunk of WP code- Help
What Theme is it or is it completely custom?
__________________
Tina Caldwell B.K.A TinaTheVA
Reply With Quote
    #6 (permalink)  
Old 08-29-2012
ChristinaVOS's Avatar
Active Member
Company name: Christina Nelson ~ Life & Biz Alchemist
 
Join Date: Nov 2007
Location: Upstate NY
Posts: 984
Send a message via AIM to ChristinaVOS Send a message via Skype™ to ChristinaVOS
Follow this virtual assistant on Twitter Find this virtual assistant on Facebook Contact this virtual assistant on LinkedIn Find this virtual assistant on Google+
Default Re: Stuck on this chunk of WP code- Help
@Lee That WOULD work except for the whole "transferred the posts" thing. None of the images are officially attached to the posts so it can't pull the first post image- tried that.

The theme is Fluence. Somewhat customized but not tons. I know it should be a simple IF/THEN statement but my head will not wrap around the PHP syntax- guess there's too much HTML/CSS/WP up in the ole' brainbox, won't make room for any more. LOL

Any other ideas? Where's codehead when you need him :-) ?

~C
__________________
~Christina
Reply With Quote
    #7 (permalink)  
Old 08-29-2012
LeeDrozak's Avatar
Community Leader
Company name: Lee Drozak Biz
 
Join Date: Aug 2008
Location: Western Pennsylvania
Posts: 3,302
Blog Entries: 13
Send a message via Skype™ to LeeDrozak
Follow this virtual assistant on Twitter Find this virtual assistant on Facebook Contact this virtual assistant on LinkedIn Find this virtual assistant on Google+ Find this virtual assistant on YouTube
Default Re: Stuck on this chunk of WP code- Help
Sorry Christina, that's all I got! I will wait for codehead to answer then snag the code for my save for later, cannot figure it out file.
__________________
Lee Drozak
WHY GO IT ALONE?... I am here to help you get unstuck.
Reply With Quote
    #8 (permalink)  
Old 08-29-2012
ChristinaVOS's Avatar
Active Member
Company name: Christina Nelson ~ Life & Biz Alchemist
 
Join Date: Nov 2007
Location: Upstate NY
Posts: 984
Send a message via AIM to ChristinaVOS Send a message via Skype™ to ChristinaVOS
Follow this virtual assistant on Twitter Find this virtual assistant on Facebook Contact this virtual assistant on LinkedIn Find this virtual assistant on Google+
Default Re: Stuck on this chunk of WP code- Help
@Lee LOL
Exactly what I plan to do.
If there weren't so many posts to deal with I would just trudge through it but, having over 300 and then having to do it again on clients copycat non-english site- Just don't want to :-)

~C
__________________
~Christina
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Problem] I'm Stuck Again! burneyvoa Websites and Blogs 2 06-21-2012 02:56 PM
Stuck caroline Determining Your Services 4 02-08-2012 01:38 PM
Stuck for a name... kristyle Branding Your Business 5 10-10-2008 04:32 AM


All times are GMT -7. The time now is 08:40 AM.

Virtual Assistant Forums Advertising
Virtual Assistant Directory
Work from Home | Become A Virtual Assistant
Create a Professional New Client Welcome Packet
Virtual Assistant Forums Advertising

© Virtual Assistant Forums 2014 Content and images protected under copyright law.
Google+ - Facebook