Hello!
I'm converting an HTML-based website to WordPress, but many of the HTML pages incorporate PHP to duplicate text that is common across the website.
Here's my question: how do you combine a series of variables such as this:
Into a second chunk of text-based code such as this:
We're trying to create 50 different pages – one for each of the 50 states in the USA – without having to write every line of code for each page.
To clarify, the main text on the pages for California and Texas will be the same, except for the variables – on California, it would have
while on the Texas page, the variable would be
I've tried doing the shortcode as PHP on both, as TEXT in both, in PHP on one and TEXT on the other (and vice versa). Nothing has worked so far.
This should be easy – I've done this on dozens of HTML and Bootstrap websites over the years, but WordPress is always a roadblock for me on this.
Any clues, hints or solutions would be greatly appreciated.
Thank you!
D.J.
I'm converting an HTML-based website to WordPress, but many of the HTML pages incorporate PHP to duplicate text that is common across the website.
Here's my question: how do you combine a series of variables such as this:
PHP:
<?php
$state = "California";
$city = "Los Angeles";
?>
HTML:
<h2>Legal Requirements For <?php echo $state; ?></h2>
<p>Wondering how to register in <?php echo $state; ?></p>
To clarify, the main text on the pages for California and Texas will be the same, except for the variables – on California, it would have
Code:
$state = "California";
Code:
$state = "Texas";
This should be easy – I've done this on dozens of HTML and Bootstrap websites over the years, but WordPress is always a roadblock for me on this.
Any clues, hints or solutions would be greatly appreciated.
Thank you!
D.J.
Last edited: