• 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

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    Where did you get that theme? If it’s from the WordPress repo then I can at least direct you to that theme’s sub-forum.

    Thread Starter thePixelPixie

    (@yourbusybee)

    The theme was purchased on Themeforest and the developer is not providing support.

    Thread Starter thePixelPixie

    (@yourbusybee)

    But really, since I’m looking to change the code for the page completely, this is not something the developer *should* help with. What I’m trying to figure out is why the code I’ve written isn’t calling the page I’m trying to reference there.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Have you tried switching to one of the default themes that comes with WordPress to see if the issue you’re facing is theme-specific?

    Thread Starter thePixelPixie

    (@yourbusybee)

    This isn’t a theme issue. This is a customization issue. I’m simply trying to find out what about the code I’ve written is not pulling the info I think I’m asking for. I included the original theme code in order to see if there was something about THAT that could help here. Not because I’m trying to make that code work.

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    This isn’t a theme issue. This is a customization issue.

    Yes, of a theme that you purchased and that we don’t have access to nor permit people to post large chunks of that code here. 😉

    Try this: work your code into a child theme that’s supported in these forums. Can I suggest a child theme of Twenty Fourteen? One of the moderators has provided a download ready child theme just for that.

    http://quirm.net/themes/twenty-fourteen-child/

    In that child theme’s functions.php file try your code. That will provide other volunteers with something that they can reproduce on their test setups.

    Right now using that theme isn’t going to work here. We just can’t reproduce this without that theme.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Not pulling the correct page. Not sure why…’ is closed to new replies.