0

I've a website. It was initially developed by a different developer. It has custom template work done to it. In the wp-admin "projects" can be seen in the menu.

Projects in Menu

When I click all projects, all projects appear and can be seen also on the projects page of my website. In the pages a blank page called "projects" is created and the template it is using is "projects template".

On the projects page of my website I can see all the projects added but when I add a new project (Add its' title, description, category, featured image) it is not being shown on the projects page. The code for Projects template is as follows:

 <!-- pakistan projects -->
 <section>
      <div class="container pb-40">
        <div class="section-content">
          <div class="row multi-row-clearfix">

          <?php $args = array( 'post_type' => 'projects', 'posts_per_page' => 70 , 'orderby' => 'meta_value_num', 'order' => 'DESC',
    'meta_key' => 'size' ,'category_name' => 'pakistan');
                      $loop = new WP_Query( $args );

                      if ( $loop->have_posts() ) : while ( $loop->have_posts() ) : $loop->the_post(); 

?>

            <div class="col-sm-6 col-md-4 mb-sm-60 text-left sm-text-center">
              <div class="volunteer maxwidth400 mb-30">
                <div class="thumb"><?php the_post_thumbnail('projects' ); ?></div>
                <div class="overlay">
                  <div class="content text-center">
                    <h4 class="author mb-0"><a href="<?php the_permalink(); ?>" class="text-white"><?php $excerpt = get_the_excerpt();
 echo mb_strimwidth($excerpt, 0, 100, '...');
 ?>
 </a></h4>
                    <h6 class="title text-black font-14 mt-5 mb-15"></h6>

                  </div>
                </div>
              </div>
            </div>
             <?php endwhile;endif; ?>
             </div>
        </div>
      </div>
    </section>

     <blockquote>
      <?php 
                                    query_posts("page_id=231");
                                    while ( have_posts() ) : the_post()
                                ?>
                             <h3 align="center"> 

                                    <?php echo get_post_meta($post->ID, 'project_malysia', true) ; ?>
                            </h3>
                                <?php
                                    endwhile; 
                                    wp_reset_query();
                            ?> 

    </blockquote>
 <!-- malaysia projects -->
 <section>
      <div class="container pb-40">
        <div class="section-content">
          <div class="row multi-row-clearfix">

          <?php $args = array( 'post_type' => 'projects', 'posts_per_page' => 70 , 'orderby' => 'meta_value_num', 'order' => 'DESC',
    'meta_key' => 'size' ,'category_name' => 'malaysia');
                      $loop = new WP_Query( $args );

                      if ( $loop->have_posts() ) : while ( $loop->have_posts() ) : $loop->the_post(); ?>

            <div class="col-sm-6 col-md-4 mb-sm-60 text-left sm-text-center">
              <div class="volunteer maxwidth400 mb-30">
                <div class="thumb"><?php the_post_thumbnail('projects'); ?></div>
                <div class="overlay">
                  <div class="content text-center">
                    <h4 class="author mb-0"><a href="<?php the_permalink(); ?>" class="text-white"><?php $excerpt = get_the_excerpt();
 echo mb_strimwidth($excerpt, 0, 100, '...');
 ?>
 </a></h4>
                    <h6 class="title text-black font-14 mt-5 mb-15"></h6>

                  </div>
                </div>
              </div>
            </div>
             <?php endwhile;endif; ?>
             </div>
        </div>
      </div>
    </section>

Summary: Can see the newly added project in the project list appearing in "All projects" but not on the Projects page which is using "Projects template". However all previously added projects which are appearing in the "all projects" are appearing on the website. Any help will be highly appreciated.

  • Well, the projects page is querying for posts that have the custom field (or meta) named size and that the post is in the pakistan category. So when you add new projects, you should add that custom field and assign the pakistan category to the new project. – Sally CJ Nov 9 at 13:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.