Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Nov 2011
    Posts
    138
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Question Why isn't it pulling the right Page?

    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 Code:
    <?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 ( == $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(7570);
                                    
    $attr 'class=aligncenter icon';
                                    
    the_post_thumbnail$size$attr ); ?>
                                    <h3><a href="<?php the_permalink(); ?>"><?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 class="fr_simple_btn" href="<?php echo esc_html(get_option('FR_SERVICE_INCLUSION_LINK')); ?>"><?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 Code:
    <?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

  • #2
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,323
    Thanks
    60
    Thanked 525 Times in 512 Posts
    Blog Entries
    4
    The reality is that nobody here is going to know WP in such depth that they can help you. You have two realistic choices..

    1) Go and get support from wordpress
    2) Debug the code yourself and see what is going wrong. If you're not clued up on debugging, see #1 or hire someone to debug it for you.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •