gareth-gillman
6/13/2016 - 1:48 PM

FullpageJS in WordPress

FullpageJS in WordPress

function my_scripts() {
  if ( !is_admin()) {
   wp_enqueue_script('jquery');
   wp_enqueue_style( 'fullpagecss', trailingslashit( get_template_directory_uri() ) . 'css/jquery.fullPage.css', array(), '2.8.1', 'all' );
   wp_enqueue_script('fullpagejs', trailingslashit( get_template_directory_uri() ) . '/js/jquery.fullPage.min.js', array('jquery'), array(), '2.8.1', true );
  }
 }
 add_action( 'wp_print_scripts', 'my_scripts');
<div id="fullpage">
  
  <?php
  $args = array(
   'sort_column' => 'menu_order'
  );
  $pages = get_pages($args);
  $i = 0;
  foreach ( $pages as $page ) {
   ?>
 	 
 	 <div class="section <?php if($i=='1'){echo 'active'}; ?>" id="<?php echo $page->post_name; ?>">
 	  <?php echo $page->post_content; ?>
 	 </div>
	 
	 <?php
	 $i++;
	}
	?>
	
</div>