Mobile app version of vmapp.org
Login or Join
Berumen354

: You can create a dynamic output using PHP inside the 404.php template. Effectively you use the 404.php to include your header, footer and any navigation as per a normal template, and then

@Berumen354

You can create a dynamic output using PHP inside the 404.php template.

Effectively you use the 404.php to include your header, footer and any navigation as per a normal template, and then swap out the normal loop and create a block of content that is randomised - e.g.:

<?
$num = Rand (1,4);
switch ($num) { // Here's 4 different examples
case 1:
echo "<div>content goes here</div>"; //normal HTML
break;
case 2:
echo $string_output_youve_set_earlier; //HTML in a string
break;
case 3:
include 'random_block_3.php'; //a PHP block
break;
case 4:
get_template_part('random','four'); //Using WordPress's own engine
}
?>

10% popularity Vote Up Vote Down


Login to follow query

More posts by @Berumen354

0 Comments

Sorted by latest first Latest Oldest Best

Back to top | Use Dark Theme