Avatar of Andy6350
Andy6350
 asked on

Wordpress post not appearing

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
WordPressPHPWeb Languages and StandardsWeb Development

Avatar of undefined
Last Comment
Andy6350

8/22/2022 - Mon
Jason C. Levine

What did you change to style it differently?
Andy6350

ASKER
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 ?>
Jason C. Levine

When I do a search on your site for news, I get:

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

Is that the post?
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Andy6350

ASKER
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
Jason C. Levine

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?
Andy6350

ASKER
I have attached a photo of my permalink settings
Screen-shot-2012-03-14-at-17.44.jpg
âš¡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Jason C. Levine

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/
Andy6350

ASKER
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 :/
Jason C. Levine

>> 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?
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Andy6350

ASKER
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'
Jason C. Levine

Can you paste the theme's category.php here?
Andy6350

ASKER
<?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(); ?>
âš¡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Jason C. Levine

Can I also see loop.php?

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

ASKER
<?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; ?>
Andy6350

ASKER
I didnt really want to switch themes as the site is live
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Jason C. Levine

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.
Andy6350

ASKER
I have switched themes but the post is still not appearing?
Jason C. Levine

Alright, now disable ALL plugins and see if the post shows up.
âš¡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Andy6350

ASKER
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,
Andy6350

ASKER
I apologise, yes no new posts are showing up, not even her properties! :/
Andy6350

ASKER
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
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Andy6350

ASKER
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; ?>
Andy6350

ASKER
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?
Jason C. Levine

>> 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.
âš¡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
Andy6350

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Jason C. Levine

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?
Andy6350

ASKER
Solved the problem