Skip to main content

Create a custom page

What is Custom Page ? what the difference with regular page ? basically regular page is just a post with “page” identifier.

With “Custom page” you have a full control from the first HTML tag until the end of the page, PHP code is allowed here, also you can use existing CloudArcade functions.

Let’s get started

First, open your active theme folder, example: “/content/themes/default/”.

Create a php file, name it with “page-test.php”

Edit the script/file, then put “It’s working!” text on it, save it.

You can access it with your-domain.com/test (pretty url), “It’s working!” should be displayed.

You can also using “Custom Pages” plugin to create custom page easily without FTP

Next, let’s try to access CloudArcade functions

Clear all text from “page-test.php”, then put code below:

<?php

$data = get_game_list('new', 10);
$games = $data['results'];

echo '<ul>';

foreach ($games as $game) {
	echo '<li>'. $game->title .'</li>';
}

echo '</ul>';

?>

Now we can show 10 new games from “test” page, but it’s look very basic, we need to make it’s design to match with current active theme.

Update “page-test.php” with code below:

<?php

$page_title = 'TEST PAGE';
$meta_description = 'Test description';

require_once( TEMPLATE_PATH . '/functions.php' ); //Load theme functions

include  TEMPLATE_PATH . "/includes/header.php";

$data = get_game_list('new', 10);
$games = $data['results'];

echo '<ul>';

foreach ($games as $game) {
	echo '<li>'. $game->title .'</li>';
}

echo '</ul>';

include  TEMPLATE_PATH . "/includes/footer.php"

?>

We include theme header, footer and functions with code above, now it’s look similar with our active theme.

There are many features and scripts you can access from Custom Page, more info at developer documentation

Update: You can use “Custom Pages” plugin to create, edit or delete custom pages easily.