Solved

Wordpress post not appearing

Posted on 2012-03-14
28
303 Views
Last Modified: 2012-05-09
Hi.

I have a category that i have made which is for latest news:

http://local-estateagent.co.uk/category/news/

I am trying to style this category different to how all the other categories appear. I have added 1 post to the category 'News' to test and style accordingly. The problem i have is that this post is not appearing on the page and i am now lost as to where i am with it. I dont want to get too confused so thought i would ask for help.

Please let me know if you need the login information or what files you need to see?

Many thanks,

Andrew
0
Comment
Question by:Andy6350
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 16
  • 11
28 Comments
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 37721291
What did you change to style it differently?
0
 

Author Comment

by:Andy6350
ID: 37721312
In the header-search.ph file which is used on the categories, i put the following code:

<?php if (is_category('news') ):
        // category latest-news ?>
   
      <style type="text/css">
      
      #main {
            
            background-image:url(/wp-content/themes/localestateagent/images/news-bg.jpg);            
}
#cat-content {
      width:434px;
      float:left;
      margin:0px;
}
#container {
      width:434px;
      float:left;
      margin:0px;
      
}
.entry-content, .entry-summary {
      width:100%;
}

      </style>
   

<?php endif; // end the if, no images for other other categories ?>
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 37721321
When I do a search on your site for news, I get:

http://local-estateagent.co.uk/news-1.html

Is that the post?
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 

Author Comment

by:Andy6350
ID: 37721362
yes, I have attached a jpg of the result i am after. I want all the posts in the category 'news' to display like the attached image. The rest of the categories to stay the same.
latestnews.jpg
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 37721449
No, I understand what your desired end result is.  I'm trying to determine how you got a wordpress post to end up with the .html extension and outside of the normal taxonomy.

How do you have the permalinks structured, etc?
0
 

Author Comment

by:Andy6350
ID: 37721469
I have attached a photo of my permalink settings
Screen-shot-2012-03-14-at-17.44.jpg
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 37721492
Okay a couple of things:

1) You need to run some updates.

2) What plugins are installed?

3) In the category permalink box, try entering:

/category/%category%/

and then test http://local-estateagent.co.uk/category/news/
0
 

Author Comment

by:Andy6350
ID: 37721525
I changed the permalink and it said that the page could not be found. so i have changed it back. I dont understand why the post isn't listing, because all i changed was the styling. I am a bit nervous about updating any plugins as i am concerned they will conflict.

Post News 1 should be appearing in that news category :/
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 37721536
>> I am a bit nervous about updating any plugins as i am concerned they will conflict.

See, I think you have a plugin already in conflict with something and that's why the category page isn't working properly.

Try just:

/%category%

in that permalink and test with http://local-estateagent.co.uk/news

(also, check the category slug and make sure it is "news")

Do you have any other categories defined?
0
 

Author Comment

by:Andy6350
ID: 37721712
I tried /%category% and it said page not found.

The reason i didn't think it was a conflict, was because it has been working fine until now, i havent added anything.

The slug does say 'news'
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 37722022
Can you paste the theme's category.php here?
0
 

Author Comment

by:Andy6350
ID: 37722470
<?php
/**
 * The template for displaying Category Archive pages.
 *
 * @package WordPress
 * @subpackage Twenty_Ten
 * @since Twenty Ten 1.0
 */
?>
<?php include (TEMPLATEPATH . '/header-search.php'); ?>
<div class="slogan-strip">

        <div id="search" class="widget-container widget_search">
         
         
      
      <?php get_search_form(); ?>
   
 
 

        </div>

</div>


<?php if (is_category('news')) { ?>

                                                      <?php include (TEMPLATEPATH . '/sidebar-news.php'); ?>
                                   
                                     <?php } ?>


            <div id="container">
                  <div id="cat-content" role="main">




                        <h1 class="widget-title">
                        
               
                        
                        <?php
$category = get_the_category();
$parent = get_cat_name($category[0]->category_parent);


echo $parent;



?>


                        <?php
                              printf( __( '%s', 'twentyten' ), '<span>' . single_cat_title( '', false ) . '</span>' );
                        ?></h1>
               
               
               
               
               
               
               
                        <?php
                              $category_description = category_description();
                              if ( ! empty( $category_description ) )
                                    echo '<div class="archive-meta">' . $category_description . '</div>';

                        /* Run the loop for the category page to output the posts.
                         * If you want to overload this in a child theme then include a file
                         * called loop-category.php and that will be used instead.
                         */
                        get_template_part( 'loop', 'category' );
                        ?>

                  </div><!-- #content -->
            </div><!-- #container -->

<?php get_sidebar(); ?>


</div><!--main-->

<?php get_footer(); ?>
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 37722731
Can I also see loop.php?

Also, have you tried switching to a new theme for testing and also disabling plugins?
0
 

Author Comment

by:Andy6350
ID: 37722755
<?php
/**
 * The loop that displays posts.
 *
 * The loop displays the posts and the post content.  See
 * http://codex.wordpress.org/The_Loop to understand it and
 * http://codex.wordpress.org/Template_Tags to understand
 * the tags used in it.
 *
 * This can be overridden in child themes with loop.php or
 * loop-template.php, where 'template' is the loop context
 * requested by a template. For example, loop-index.php would
 * be used if it exists and we ask for the loop with:
 * <code>get_template_part( 'loop', 'index' );</code>
 *
 * @package WordPress
 * @subpackage Twenty_Ten
 * @since Twenty Ten 1.0
 */
?>
<?php if (in_category('testimonials')) { ?>

                                                      <div class="testimonial-intro">
                                   
                                                            <p>
                                                            Find out below how much our clients saved and what they had to say about it. Click on the properties below for more details, testimonials and fee savings.
                                        </p>
                                    </div>
                                   
                                    <div class="testimonial-bottom"></div>
                                   
                                     <?php } ?>



   


<?php /* Display navigation to next/previous pages when applicable */ ?>
<?php if ( $wp_query->max_num_pages > 1 ) : ?>
      <div id="nav-above" class="navigation">
    <?php if(function_exists('wp_page_numbers')) : wp_page_numbers(); endif; ?>
            <?php /*?><div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Previous Properties', 'twentyten' ) ); ?></div>
            <div class="nav-next"><?php previous_posts_link( __( 'More Properties <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?></div><?php */?>
      </div><!-- #nav-above -->
<?php endif; ?>

<?php /* If there are no posts to display, such as an empty archive page */ ?>


<?php if ( ! have_posts() && ! is_category('25')  ) : ?>
      <div id="post-0" class="post error404 not-found">
            <h1 class="entry-title"><?php _e( 'No properties available', 'twentyten' ); ?></h1>
            <div class="entry-content">
                  <p><?php _e( 'Apologies, but we have currently no properties available within this category', 'twentyten' ); ?></p>
                  
            </div><!-- .entry-content -->
      </div><!-- #post-0 -->
   
   

<?php endif; ?>

 <?php if (is_category('25') && ! have_posts()) { ?>
      <div id="post-0" class="post error404 not-found">
            <h1 class="entry-title"><?php _e( 'Our testimonials will be coming shortly', 'twentyten' ); ?></h1>
            <div class="entry-content">
                  <p><?php _e( 'Apologies, but we have many testimonials coming soon, thank you for your patience.', 'twentyten' ); ?></p>
                  
            </div><!-- .entry-content -->
      </div><!-- #post-0 -->
   
   
<?php } ?>





<?php
      /* Start the Loop.
       *
       * In Twenty Ten we use the same loop in multiple contexts.
       * It is broken into three main parts: when we're displaying
       * posts that are in the gallery category, when we're displaying
       * posts in the asides category, and finally all other posts.
       *
       * Additionally, we sometimes check for whether we are on an
       * archive page, a search page, etc., allowing for small differences
       * in the loop on each template without actually duplicating
       * the rest of the loop that is shared.
       *
       * Without further ado, the loop:
       */ ?>
<?php while ( have_posts() ) : the_post(); ?>

<?php /* How to display posts in the Gallery category. */ ?>

      
      
      <?php if ( in_category( _x('gallery', 'gallery category slug', 'twentyten') ) ) : ?>
            <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
                  <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>

                  <div class="entry-meta">
                        <?php twentyten_posted_on(); ?>
                  </div><!-- .entry-meta -->

                  <div class="entry-content">
<?php if ( post_password_required() ) : ?>
                        <?php the_content(); ?>
<?php else : ?>                  
                        <?php
                              $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
                              if ( $images ) :
                                    $total_images = count( $images );
                                    $image = array_shift( $images );
                                    $image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' );
                        ?>
                                    <div class="gallery-thumb">
                                          <a class="size-thumbnail" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
                                    </div><!-- .gallery-thumb -->
                                    <p><em><?php printf( __( 'This gallery contains <a %1$s>%2$s photos</a>.', 'twentyten' ),
                                                'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
                                                $total_images
                                          ); ?></em></p>
                        <?php endif; ?>
                                    <?php the_excerpt(); ?>
<?php endif; ?>
                  </div><!-- .entry-content -->
 
                  <div class="entry-utility">
                        <a href="<?php echo get_term_link( _x('gallery', 'gallery category slug', 'twentyten'), 'category' ); ?>" title="<?php esc_attr_e( 'View posts in the Gallery category', 'twentyten' ); ?>"><?php _e( 'More Galleries', 'twentyten' ); ?></a>
                        <span class="meta-sep">|</span>
                        <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
                        <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
                  </div><!-- .entry-utility -->
         

            </div><!-- #post-## -->
       

<?php /* How to display all other posts. */ ?>

      <?php else : ?>
   
   
   
   
   
     <?php if ( is_archive()) : // Only display excerpts for archives and search. ?>
     
     
     
     
     <div id="post-<?php the_ID(); ?>" <?php post_class(); ?> >
                      <div id="property-item">
                        <div class="thumb">
                        <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_post_thumbnail('thumbnail'); ?></a>
                        </div>
                               <div class="innerDivLeft">
                   
                   
                   
                                                                       <div class="list-header">
                                                                       <div class="list-location">  
                                                                           <h2><?php if ( get_post_meta($post->ID, 'address line 2', true) ) : ?>
                                                                           <?php echo get_post_meta($post->ID, 'address line 2', true) ?>
                                                                           <?php endif; ?></h2>
                                                                       </div>
                                                                       
                                                                       <div class="list-price">
                                                                       
                                                                           <h2><?php if ( get_post_meta($post->ID, 'price', true) ) : ?>
                                                                           <?php echo get_post_meta($post->ID, 'price', true) ?>
                                                                           <?php endif; ?></h2>
                                                                       
                                                                       </div><div class="divClear"></div>    
                                                                        </div><!-- .list-header -->                            
                                                                                                 
                                                                                <h3><?php the_title(); ?></h3>
                                                                                   
                                                                                <div class="property-description-entry-summary">
                                                                                <?php /*?><?php the_excerpt(); ?><?php */?><?php excerpt('20'); ?>
                                                                                 <div>
                   
                     <?php if ( get_post_meta($post->ID, 'sold', true) ) : ?>
                         <div class="sold"><?php echo get_post_meta($post->ID, 'sold', true) ?>
                            </div>  
                         <?php else:?>
                         
                         
                         <?php endif; ?>
                   
                </div>  
                                                                               
                                                                     
                                                                     
                                                                        </div><!-- .entry-summary -->
                                                                          <div class="divClear"></div>
                                                                       
                                                                       
                                                                       
                 </div><!-- .innerDivLeft -->        
                  <div class="divClear"></div>                                          
                     
                      </div><!-- #property-item -->  
             
             
             </div>
           
             <?php endif; ?>
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
     <?php if ( is_search()) : // Only display excerpts for archives and search. ?>
      <div id="post-<?php the_ID(); ?>" <?php post_class(); ?> >
     <h2><?php the_title(); ?></h2>
                                                                     <div class="entry-summary">
                                                                     <?php the_excerpt(); ?>
                                                                     
                                                                     </div><!-- .entry-summary -->
   
     
             
             
             </div>
             <?php endif; ?>
             
               
               
               
                                                           
                                                           
                                                           
                                                             
                                     
                   
       
    <div class="divClear"></div>
   
     

            <?php comments_template( '', true ); ?>

      <?php endif; // This was the if statement that broke the loop into three parts based on categories. ?>
   
   

<?php endwhile; // End the loop. Whew. ?>


<?php if (is_category('18')) { ?>

<div class="why-not">

<h2>Why not call us today!</h2>
<h2>Telephone <span style="color:#f172ac;">01480 370844</span></h2>


</div>

<?php } elseif (is_category('19')) { ?>

<div class="why-not">

<h2>Why not call us today!</h2>
<h2>Telephone <span style="color:#f172ac;">01480 370844</span></h2>


</div>


<?php } elseif (is_category('20')) { ?>

<div class="why-not">

<h2>Why not call us today!</h2>
<h2>Telephone <span style="color:#f172ac;">01480 370844</span></h2>


</div>


<?php } elseif (is_category('21')) { ?>

<div class="why-not">

<h2>Why not call us today!</h2>
<h2>Telephone <span style="color:#f172ac;">01480 370844</span></h2>


</div>


<?php } elseif (is_category('22')) { ?>

<div class="why-not">

<h2>Why not call us today!</h2>
<h2>Telephone <span style="color:#f172ac;">01480 370844</span></h2>


</div>


<?php } else { ?>

<div class="why-not">

<h2>Why not call us today!</h2>
<h2>Telephone <span style="color:#f172ac;">01480 210222</span></h2>


</div>
 
<?php } ?>

       




<?php /* Display navigation to next/previous pages when applicable */ ?>
<?php if (  $wp_query->max_num_pages > 1 ) : ?>
                        <div id="nav-below" class="navigation">
               
                <?php if(function_exists('wp_page_numbers')) : wp_page_numbers(); endif; ?>
                              <?php /*?><div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Previous Properties', 'twentyten' ) ); ?></div>
                              <div class="nav-next"><?php previous_posts_link( __( 'More Properties <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?></div><?php */?>
                        </div><!-- #nav-below -->
<?php endif; ?>
0
 

Author Comment

by:Andy6350
ID: 37728770
I didnt really want to switch themes as the site is live
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 37730399
I understand that but we need to determine the cause of the problem.  Switching themes, albeit briefly, will tell us if the alterations to your theme files are causing the issue or the plugins.
0
 

Author Comment

by:Andy6350
ID: 37762439
I have switched themes but the post is still not appearing?
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 37764104
Alright, now disable ALL plugins and see if the post shows up.
0
 

Author Comment

by:Andy6350
ID: 37770206
I am pretty sure its not a plugin issue, as my other styled category appears ok.

This is the original testimonials category style:

http://local-estateagent.co.uk/category/testimonials/

This is the new news category style which is not showing the posts that are in the news category:

http://local-estateagent.co.uk/category/news/

I cant see how this would be a plugin issue? as i can add new posts to the testimonials category.

Thanks,
0
 

Author Comment

by:Andy6350
ID: 37770346
I apologise, yes no new posts are showing up, not even her properties! :/
0
 

Author Comment

by:Andy6350
ID: 37770519
I think i have narrowed the issue down. It seems that it WILL upload posts, but only if they all the custom fields for that post/property have been filled in :/ very odd
0
 

Author Comment

by:Andy6350
ID: 37770539
this is what i have for my custom post:

<?php if ( get_post_meta($post->ID, 'address line 1', true) ) : ?>
                                    <?php echo get_post_meta($post->ID, 'address line 1', true) ?>
                                    <?php endif; ?>
0
 

Author Comment

by:Andy6350
ID: 37771294
I thought about only showing the custom fields if they are in a certain category. I tried the following code with no luck:

<?php if (is_category('17,23,25') || cat_is_ancestor_of(17,23,25, $cat)) { ?>
                                                      <?php if ( get_post_meta($post->ID, 'address line 1', true) ) : ?>
                                                      <?php echo get_post_meta($post->ID, 'address line 1', true) ?>
                                                      <?php endif; ?>
                                   <?php } ?>

Any Ideas?
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 37774880
>> I cant see how this would be a plugin issue?

Since I have no visibility to how you set up the site or what other alterations you have made or plugins you are using, I'm going through the list of common problems.  Custom fields shouldn't care if they are filled out or not unless you've also changed something in how the Loop behaves so that only posts with all fields present get pulled.  This is the first mention of custom fields in the posts so there's a whole other world of issues to examine.

As I'm out of ideas and you seem resistant to trying what I suggest anyway, I'm bowing out here.  Good luck.
0
 

Accepted Solution

by:
Andy6350 earned 0 total points
ID: 37928740
Was a plugin Issue

Problem resolved
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 37930882
So since I initially suggested plugins were a source of the problem, how come I don't get at least a split of the points?
0
 

Author Closing Comment

by:Andy6350
ID: 37945909
Solved the problem
0

Featured Post

Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question