Not pulling the correct page. Not sure why…
-
Hi there,
I’m working on a one-page WordPress site for a client. Started with a template, which is getting hugely modified. But I’m running into a difficulty that I hope someone here can help me with:This is a custom post-type which is supposed to call a particular set of pages from an array in the admin area. However, I only want this section to have 1 page called (the admin area gives the choice of 3 or 6 – 1 row of 3 or 2 rows of 3). Here is the original php for the page:
<?php $service_name = get_option('FR_SERVICE_SECTION_NAME'); ?> <div id="services" class="clearfix"> <div class="sizers clearfix"> <h3 class="section_name"><?php echo esc_html($service_name); ?></h3> <div class="servise_items clearfix"> <?php $fr_blocks_count = get_option('FR_SERVICE_COUNT'); for ($i=1; $i <=$fr_blocks_count; $i++) { $service_query = new WP_Query('page_id=' . fr_get_pageId(html_entity_decode(get_option('FR_HOME_PAGE_'.$i)))); while ( $service_query->have_posts() ) : $service_query->the_post(); global $more; $more = 0; ?> <div class="service<?php if ( 1 == $i ) echo ' first'; if ( $fr_blocks_count == $i ) echo ' last'; ?>"> <?php $attachments = get_children(array('post_parent' => get_the_ID(), 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order')); if ( ! is_array($attachments) ) continue; $count = count($attachments); $first_attachment = array_shift($attachments); ?> <?php $size = array(75, 70); $attr = 'class=aligncenter icon'; the_post_thumbnail( $size, $attr ); ?> <h3><a>"><?php the_title(); ?></a></h3> <p><?php echo excerpt(25); ?></p> </div> <!-- end .service --> <?php endwhile; wp_reset_postdata(); ?> <?php } ?> </div> <!-- end .servise_items --> </div> <!-- end of .sizers --> </div> <!-- end #services --> <?php $service_inclusion = get_option('FR_SERVICE_INCLUSION'); if( $service_inclusion <> '' ){ ?> <!-- CALL TO ACTION --> <section id="fr_converse" class="fr_converse_gray"> <div class="sizers clearfix"> <div class="two_third"> <p><?php echo esc_html( $service_inclusion ); ?></p> </div> <div class="one_third last"> <a>"><?php echo esc_html(get_option('FR_SERVICE_INCLUSION_TEXT')); ?></a> </div> </div> </section> <!-- CALL TO ACTION --> <?php } ?>
I don’t need the call to action section, so that came out. I also wanted to display the full article instead of just an excerpt. And only 1 article so I changed the CSS so it has a width of 100%. The section title is being properly pulled from the admin area, but the code keeps pulling the Home article (which is the 3rd one listed) instead of the 1st one (which I’ve titled Service). I’ve tried to manually set the name of the post to pull from, I’ve tried telling it which post (page in this case) number to use, and various configurations. This is the code as I currently have it:
<?php $service_name = get_option('FR_SERVICE_SECTION_NAME'); ?> <div id="services" class="clearfix"> <div class="sizers clearfix"> <h3 class="section_name"><?php echo esc_html($service_name); ?></h3> <div class="servise_items clearfix"> <div class="service"> <p><?php $query = new WP_Query( 'page_id=23' ); the_content(); ?></p> </div> <!-- end .service --> <?php ?> </div> <!-- end .servise_items --> </div> <!-- end of .sizers --> </div> <!-- end #services --> <?php $service_inclusion = get_option('FR_SERVICE_INCLUSION'); if( $service_inclusion <> '' ){ ?> <?php } ?>
Note the misspelling of service throughout. This is by the original theme developer.
HELP!!!
Thanks in advance.
~Laura
- The topic ‘Not pulling the correct page. Not sure why…’ is closed to new replies.