<commit_before># ![Alt text](images/logo.jpg "SECT") WP Split Single Page - For Each Array of custom field -

### Supply some functions and Pagination for split single page for each array of custom field without `<!--nextpage-->` on your template.

#### Installation
- - -
 1. `cd /path-to-your/wp-content/plugins/`
 2. `git clone <EMAIL>@github.com:sectsect/wp-split-single-page.git`
 3. Activate the plugin through the 'Plugins' menu in WordPress.

 That's it:ok_hand:

#### functions
- - -
* `is_single_paged($num)`	- Detect the specific split page.
* `single_paginate($args)`	- Output the pagination.

### Usage Example
- - -

#### single.php
NOTE: Split the page every two arrays.

	<?php get_header(); ?>

	<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

	<article>
		<h1><?php the_title(); ?></h1>

		<?php if (is_single_paged(1)): ?>
			<section>
				something...
			</section>
		<?php endif; ?>

		<?php
			$fields    = CFS()->get('section');
			$fields    = array_chunk($fields, 2);
			if(!is_preview()){
				$paged   = (get_query_var('page')) ? get_query_var('page') : 1;
			}else{
				$pagenum = $_GET['paged'];
				$paged   = ($pagenum) ? $pagenum : 1;
			}
			$key       = $paged - 1;    // "-1" For Array's key
			$pagecount = count($fields);
			$fields    = $fields[$key];
			foreach ($fields as $field):
		?>
			<section>
				<?php if ($field['h2']): ?>
					<h2><?php echo $field['h2']; ?></h2>
				<?php endif; ?>

				<?php if ($field['h3']): ?>
					<h3><?php echo $field['h3']; ?></h3>
				<?php endif; ?>

				<?php if ($field['text']): ?>
					<?php echo $field['text']; ?>
				<?php endif; ?>
			</section>
		<?php endforeach; ?>

		<section class="pagenation">
			<?php
				if(function_exists('single_paginate')){
					$args = array(
						'total'    => $pagecount,
						'current'  => $paged
					);
					single_paginate($args);
				}
			?>
		</section>
	</article>

	<?php endwhile; endif; ?>

	<?php get_footer(); ?>


### Change log  
 * **1.0.0** - Initial Release
<commit_msg>Fix README.md<commit_after># ![Alt text](images/logo.jpg "SECT") WP Split Single Page - For Each Array of custom field -

### Supply some functions and Pagination for split single page for each array of custom field without `<!--nextpage-->` on your template.

#### Installation
- - -
 1. `cd /path-to-your/wp-content/plugins/`
 2. `git clone git@github.com:sectsect/wp-split-single-page.git`
 3. Activate the plugin through the 'Plugins' menu in WordPress.

 That's it:ok_hand:

#### functions
- - -
* `is_single_paged($num)`	- Detect the specific split page. (`boolean`)
* `single_paginate($args)`	- Output the pagination.

### Usage Example
- - -

#### single.php
NOTE: Split the page every two arrays.

	<?php get_header(); ?>

	<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

	<article>
		<h1><?php the_title(); ?></h1>

		<?php if (is_single_paged(1)): ?>
			<section>
				something...
			</section>
		<?php endif; ?>

		<?php
			$fields    = CFS()->get('section');
			$fields    = array_chunk($fields, 2);
			if(!is_preview()){
				$paged   = (get_query_var('page')) ? get_query_var('page') : 1;
			}else{
				$pagenum = $_GET['paged'];
				$paged   = ($pagenum) ? $pagenum : 1;
			}
			$key       = $paged - 1;    // "-1" For Array's key
			$pagecount = count($fields);
			$fields    = $fields[$key];
			foreach ($fields as $field):
		?>
			<section>
				<?php if ($field['h2']): ?>
					<h2><?php echo $field['h2']; ?></h2>
				<?php endif; ?>

				<?php if ($field['h3']): ?>
					<h3><?php echo $field['h3']; ?></h3>
				<?php endif; ?>

				<?php if ($field['text']): ?>
					<?php echo $field['text']; ?>
				<?php endif; ?>
			</section>
		<?php endforeach; ?>

		<section class="pagenation">
			<?php
				if(function_exists('single_paginate')){
					$args = array(
						'total'    => $pagecount,
						'current'  => $paged
					);
					single_paginate($args);
				}
			?>
		</section>
	</article>

	<?php endwhile; endif; ?>

	<?php get_footer(); ?>


### Change log  
 * **1.0.0** - Initial Release

{'fraction_non_alphanumeric': 0.20823065549531788, 'fraction_numerical': 0.010842779694430755, 'mean_word_length': 2.971624266144814, 'pattern_counts': {'":': 0, '<': 72, '<?xml version=': 0, '>': 78, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6730031', 'n_tokens_mistral': 1719, 'n_tokens_neox': 1448, 'n_words': 364}