A.Gabri Posted June 19, 2010 Share Posted June 19, 2010 after updating to WP3 my theme seems to have a weird problem <?php the_content(); ?> & <?php the_author_meta('description'); ?> is not grabbing any data from WP everything else is working except for those and this is just in my theme only . this is the custom page i`m using <?php /* Template Name: Custom */ ?> <?php get_header(); ?> <?php if(is_page('home')){ ?> <h2 id="tagline" class="intro"> <?php the_content(); ?> </h2> <?php $services=get_post_meta($post->ID,'my_services',true); ?> <div id="services" class="home_intro"> <?php echo $services; ?> </div> <?php $action=get_post_meta($post->ID,'action_buttons',true); ?> <div id="action_buttons" class="home_intro"> <?php echo $action; ?> </div> <div id="blog_latest" class="home_intro"> <h3>blog</h3> <ul> <?php $postslist=get_posts('numberposts=3&order=DES&orderby=date'); foreach ($postslist as $post): setup_postdata($post); ?> <li> <p> <a href="<?php the_permalink();?>"> <?php the_title(); ?> </a> <em> <?php the_date(); ?> </em> </p> </li> <?php endforeach; ?> </ul> </div> <?php } else{ ?> <?php if(is_page('about')){ ?> <h2> <?php wp_title(''); ?> </h2> <div id="about"> <?php the_author_meta('description'); ?> </div> <?php $status=get_post_meta($post->ID,'status',true); if($status): ?> <p id="status"> <a href="../contact/" title="" class="available"> <?php echo $status; ?> </a> </p> <?php endif; ?> <div id="about_sidebar"> <?php $skills=get_post_meta($post->ID,'skills',true); ?> <div id="skills"> <?php echo $skills; ?> </div> <?php $goodies=get_post_meta($post->ID,'goodies',true); ?> <div id="goodies"> <?php echo $goodies; ?> </div> </div> <?php $resume=get_post_meta($post->ID,'resume',true); ?> <?php echo $resume; ?> <?php } else{ ?> <?php if(!is_page('blog')){?> <h2> <?php wp_title(''); ?> </h2> <?php the_content(); ?> <?php } else{ ?> <h2>Not Found</h2> <p> Sorry, but you are looking for something that isn't here. </p> <?php } ?> <?php } ?> <?php } ?> <?php get_footer(); ?> Link to comment Share on other sites More sharing options...
0 primexx Posted June 19, 2010 Share Posted June 19, 2010 might help if you post the entire theme so we can test it out Link to comment Share on other sites More sharing options...
0 A.Gabri Posted June 19, 2010 Author Share Posted June 19, 2010 might help if you post the entire theme so we can test it out the problem occurs only in the pages that uses this template only so i don`t think it has anything to do with the entire theme Link to comment Share on other sites More sharing options...
0 Cupcakes Posted June 19, 2010 Share Posted June 19, 2010 You can't grab the_content outside of the loop.. You might want to read up on the_loop (http://codex.wordpress.org/The_Loop) and the_content (http://codex.wordpress.org/Template_Tags/the_content). For the_content: Displays the contents of the current post. This tag must be within The_Loop. Example <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <?php the_content(); ?> <?php endwhile; else: ?> <p><?php _e('Sorry, no posts matched your criteria.'); ?></p> <?php endif; ?> And if you want to use custom fields outside of the loop: <?php global $wp_query; $postid = $wp_query->post->ID; echo get_post_meta($postid, 'status', true); ?> As far as the author_meta goes, are you sure that the page you're looking at, the author has a description? Common mistake to make.. No changes to author_meta have changed for 3.0. http://codex.wordpress.org/Template_Tags/the_author_meta The the_author_meta Template Tag displays the desired meta data for a user. If this tag is used within The Loop, the user ID value need not be specified, and the displayed data is that of the current post author. A user ID can be specified if this tag is used outside The Loop. Link to comment Share on other sites More sharing options...
0 A.Gabri Posted June 20, 2010 Author Share Posted June 20, 2010 thanks +Cupcakes. but what makes the same exact template is working on WP 2.9.2 and the_content with no loop & custom fields too "although they are is still working in this page" ? & the author meta yes have a description & if i`m not wrong it`s the Biographical info box in Your profile ? Link to comment Share on other sites More sharing options...
Question
A.Gabri
after updating to WP3 my theme seems to have a weird problem <?php the_content(); ?> & <?php the_author_meta('description'); ?> is not grabbing any data from WP everything else is working except for those and this is just in my theme only .
this is the custom page i`m using
<?php /* Template Name: Custom */ ?> <?php get_header(); ?> <?php if(is_page('home')){ ?> <h2 id="tagline" class="intro"> <?php the_content(); ?> </h2> <?php $services=get_post_meta($post->ID,'my_services',true); ?> <div id="services" class="home_intro"> <?php echo $services; ?> </div> <?php $action=get_post_meta($post->ID,'action_buttons',true); ?> <div id="action_buttons" class="home_intro"> <?php echo $action; ?> </div> <div id="blog_latest" class="home_intro"> <h3>blog</h3> <ul> <?php $postslist=get_posts('numberposts=3&order=DES&orderby=date'); foreach ($postslist as $post): setup_postdata($post); ?> <li> <p> <a href="<?php the_permalink();?>"> <?php the_title(); ?> </a> <em> <?php the_date(); ?> </em> </p> </li> <?php endforeach; ?> </ul> </div> <?php } else{ ?> <?php if(is_page('about')){ ?> <h2> <?php wp_title(''); ?> </h2> <div id="about"> <?php the_author_meta('description'); ?> </div> <?php $status=get_post_meta($post->ID,'status',true); if($status): ?> <p id="status"> <a href="../contact/" title="" class="available"> <?php echo $status; ?> </a> </p> <?php endif; ?> <div id="about_sidebar"> <?php $skills=get_post_meta($post->ID,'skills',true); ?> <div id="skills"> <?php echo $skills; ?> </div> <?php $goodies=get_post_meta($post->ID,'goodies',true); ?> <div id="goodies"> <?php echo $goodies; ?> </div> </div> <?php $resume=get_post_meta($post->ID,'resume',true); ?> <?php echo $resume; ?> <?php } else{ ?> <?php if(!is_page('blog')){?> <h2> <?php wp_title(''); ?> </h2> <?php the_content(); ?> <?php } else{ ?> <h2>Not Found</h2> <p> Sorry, but you are looking for something that isn't here. </p> <?php } ?> <?php } ?> <?php } ?> <?php get_footer(); ?>Link to comment
Share on other sites
4 answers to this question
Recommended Posts