Creating your pages with LPagery is the one thing, displaying them natively in your website the other. There are multiple ways of displaying pages you created. We will go through some of them here starting with no code variations we directly built into LPagery do display pages and then go over some code examples to show you how to completely customize the way you display your created pages on your website.
When creating multiple pages it can sometimes be useful to dynamically link to the next and previous pages of a page. For example if you want your users to be able to navigate through all your existing locations for a store, you can use this to insert links at the bottom of each page to dynamically set these links. The order of the pages is the one from your source file.
For this you would need to create your buttons on your template page and insert
[lpagery_link position="NEXT" title="" circle=true target="_blank"]
and
[lpagery_link position="PREVIOUS" title="" circle=true target="_blank"]
into the “Service in Location 1” and “Service in Location 3” texts from the screenshot. You can find a detailed guide on all available interlinking attributes here:
If you want to just display a complete list of all your pages you created in one batch, you can use the built in shortcode functionality of LPagery. This lets you just copy a shortcode for a batch of created pages and then displays a list of all created pages of that batch and also links to each page. This is an easy way to create fast interlinks between your pages so they will get recognized faster by search engines like Google.
Let’s you manage your pages after they’ve been created and also let’s you get a shortcode for the created pages to display them easily.
When you are using a pagebuilder like Elementor, where you can create layouts for posts and pages, you can easily create an overview of your created pages by adding a category to the pages and then setting the display condition of your widget to the category of the created pages.
Let’s you manage your pages after they’ve been created and also let’s you get a shortcode for the created pages to display them easily.
Add a category to the pages using the LPagery dashboard.
Choose the “Posts” widget from Elementor:
When none of the above ways of displaying your pages fits your needs, you can always use custom code to display the created pages. For this you will need:
Below we have listed an examples you can copy, adjust the terms of the query and paste it into your plugin or functions.php file.
Check this post to see how you can easily create a custom plugin ->
Let’s you manage your pages after they’ve been created and also let’s you get a shortcode for the created pages to display them easily.
In this example the pages of the category “city” gets display in an alphabetical order and also each new letter gets highlighted to create a nice overview of all of your locations.
'', // No default value, user must provide the slug
),
$atts,
'sorted_pages_by_category'
);
// Check if a slug is provided
if (empty($atts['slug'])) {
return 'No slug provided. Please add a slug.
';
}
// Query arguments to get pages from the specified category
$args = array(
'post_type' => 'page', // Query only pages (not posts)
'posts_per_page' => -1, // Query all pages, no limit
'orderby' => 'title', // Sort by title
'order' => 'ASC', // Sort in ascending order (alphabetical)
'tax_query' => array( // Taxonomy query to get pages from a specific category
array(
'taxonomy' => 'category', // Category taxonomy
'field' => 'slug', // Use the slug (URL-friendly name) of the category
'terms' => $atts['slug'], // Use the provided slug
),
),
);
// Query the pages based on the arguments defined above
$pages = new WP_Query($args);
// Check if pages were found
if ($pages->have_posts()) {
// Create an array to store titles and links
$sorted_pages = array();
// Loop through the found pages
while ($pages->have_posts()) {
$pages->the_post();
$title = get_the_title(); // Get the page title
// Store the original title and permalink (URL) of the page in the array
$sorted_pages[$title] = get_permalink();
}
// Sort the array by the titles (alphabetically)
ksort($sorted_pages);
// Start output buffering (to collect HTML)
ob_start();
// Add CSS styles for layout and design
echo '';
$current_letter = ''; // Current letter (for comparison)
echo '';
// Loop through the sorted pages
foreach ($sorted_pages as $title => $permalink) {
$first_letter = strtoupper($title[0]); // First letter of the title
// Display a new letter heading if the first letter changes
if ($first_letter !== $current_letter) {
if ($current_letter !== '') {
echo ''; // Close the previous list if present
}
$current_letter = $first_letter;
echo '';
echo '' . $current_letter . ''; // Display letter indicator
echo '';
}
// Display the title with a link to the page
echo '- ' . esc_html($title) . '
';
}
// Close the last list and section
echo '
';
echo '
No pages found for slug "' . esc_html($atts['slug']) . '"
'; } } // Register shortcode to allow the code to be used within content add_shortcode('custom_lp_sorted_pages_by_category', 'display_sorted_pages_by_category');Then you can use this shortcode to display the pages of the category which you define in the shortcode in the “slug” parameter.
[custom_lp_sorted_pages_by_category slug="category-slug"]
If your page title is “Window Cleaning in City” but you don’t want to have the “Window Cleaning in” part displayed in the overview, you can simply add this line to the php code
// Remove specific placeholder text from the title to sort by actual name
$clean_title = str_replace('Window Cleaning in ', '', $title); // **This line alters the title**
// Store the cleaned title and permalink (URL) of the page in the array
$sorted_pages[$clean_title] = get_permalink(); // **This line uses the modified title**
The complete code then looks like this:
'', // No default value, user must provide the slug
),
$atts,
'sorted_pages_by_category'
);
// Check if a slug is provided
if (empty($atts['slug'])) {
return 'No slug provided. Please add a slug.
';
}
// Query arguments to get pages from the specified category
$args = array(
'post_type' => 'page', // Query only pages (not posts)
'posts_per_page' => -1, // Query all pages, no limit
'orderby' => 'title', // Sort by title
'order' => 'ASC', // Sort in ascending order (alphabetical)
'tax_query' => array( // Taxonomy query to get pages from a specific category
array(
'taxonomy' => 'category', // Category taxonomy
'field' => 'slug', // Use the slug (URL-friendly name) of the category
'terms' => $atts['slug'], // Use the provided slug
),
),
);
// Query the pages based on the arguments defined above
$pages = new WP_Query($args);
// Check if pages were found
if ($pages->have_posts()) {
// Create an array to store titles and links
$sorted_pages = array();
// Loop through the found pages
while ($pages->have_posts()) {
$pages->the_post();
$title = get_the_title(); // Get the page title
// Remove placeholder text from the title to sort by the actual name
$clean_title = str_replace('Window Cleaning in ', '', $title);
// Store the cleaned title and permalink (URL) of the page in the array
$sorted_pages[$clean_title] = get_permalink();
}
// Sort the array by the cleaned titles (alphabetically)
ksort($sorted_pages);
// Start output buffering (to collect HTML)
ob_start();
// Add CSS styles for layout and design
echo '';
$current_letter = ''; // Current letter (for comparison)
echo '';
// Loop through the sorted pages
foreach ($sorted_pages as $clean_title => $permalink) {
$first_letter = strtoupper($clean_title[0]); // First letter of the cleaned title
// Display a new letter heading if the first letter changes
if ($first_letter !== $current_letter) {
if ($current_letter !== '') {
echo ''; // Close the previous list if present
}
$current_letter = $first_letter;
echo '';
echo '' . $current_letter . ''; // Display letter indicator
echo '';
}
// Display the title with a link to the page
echo '- ' . esc_html($clean_title) . '
';
}
// Close the last list and section
echo '
';
echo '
No pages found for slug "' . esc_html($atts['slug']) . '"
'; } } // Register shortcode to allow the code to be used within content add_shortcode('custom_lp_sorted_pages_by_category', 'display_sorted_pages_by_category');Enables the creation of unique, personalized landing pages at scale by offering unlimited placeholders for dynamic content.
Essential for crafting content-rich, unique pages for each visitor or target group, optimizing for local SEO, e-commerce variability, or specific event details.