WordPress.org

Ready to get started?Download WordPress

Forums

Some PHP (1 post)

  1. Adam
    Member
    Posted 2 years ago #

    I'm not a PHP guru, so I'd like some help with just a bit of code here. I don't think this is the cause, but I'm using a Plugin called Advanced Custom Fields.

    Looks to me like this is a PHP writing issue. The "little bit of code" below is where the PHP fails in the front-end of the website. How should this be written to be proper PHP?

    Thanks for your help in advance!

    <?php $this_page_id=8; ?>
    
    		<?php $my_pages = get_pages( array( 'post_type' => 'page', 'child_of' => $this_page_id, 'posts_per_page' => -1, 'orderby' => 'menu_order', 'order' => 'ASC' ) );
    
    		foreach( $my_pages as $page ) {
    		$content = $page->post_content;
    		$content = apply_filters( 'the_content', $content ); ?>
    
    			<!-- Little bit of code... -->
    
    			<?php if (get_field('cf_example')) { ?>
    
    				<?php the_field('cf_example'); ?>
    
    			<?php } ?>
    
    			<!-- Little bit of code END -->
    
    		<?php } ?>

Topic Closed

This topic has been closed to new replies.

About this Topic