MyListing Related Listing Addon
The {CODICTS} MyListing Related Listing Addon plugin enhances the Related Listing content block on single listing pages with two major capabilities:
Preview Card Templates — Replaces the default plain-text related listing display (which shows only a logo and name) with full MyListing preview cards, rendering related listings as rich, styled cards with images, details, and the same visual treatment used on explore pages.
Block Merging — Allows multiple Related Listing blocks on the same page to be visually merged into a single combined block, creating a cleaner interface when a listing type has several related-listing fields.
Installation & Activation
Start by downloading the plugin from the Downloads page on your dashboard on the CoDicts website.
After downloading, install and activate the plugin in WordPress by navigating to “Plugins” > “Add New” > “Upload Plugin” and selecting the downloaded zip file. Click “Install Now” and then “Activate”.
On activation, the plugin automatically copies two template files to your child theme. There is no settings page — all configuration is done through the MyListing Listing Type Editor when configuring Related Listing content blocks.
Key Features
| Feature | Description |
|---|---|
| Preview Card Display | Renders related listings using MyListing’s full preview card template — the same rich cards shown on explore and search pages — instead of the default text-and-logo layout. |
| Configurable Grid Columns | Choose how many columns (1–12) to display the preview cards in, with responsive breakpoints for different screen sizes. |
| Block Merging | Combine multiple Related Listing blocks into one unified block on the single listing page. |
| Merge Block IDs | Assign a shared merge ID to group specific blocks that should be combined, supporting multiple independent merge groups. |
| Template Selection | Choose between the original “Text” template or the new “Preview Cards” template per block. |
Text vs Preview Cards
The plugin adds a new “Select A Template” dropdown to each Related Listing content block in the listing type editor:
| Template | Display |
|---|---|
| Text (default) | The original MyListing layout — a compact row with a logo thumbnail and the listing name as a clickable link. |
| Preview Cards | Full MyListing preview cards for each related listing — the same rich, styled cards with images and details that appear on explore and search pages. Displayed in a responsive grid. |
Choosing a Template for a Related Listing Block
1. In the WordPress admin, go to Listing Types.
2. Edit the listing type you want to modify.
3. Navigate to the Single Page tab (content blocks section).
4. Find an existing Related Listing block, or add a new one.
5. In the block’s settings, you will see a new dropdown: “Select A Template”.
| Option | Description |
|---|---|
| Text | Uses the original MyListing layout with logo and name. |
| Preview Cards | Renders each related listing using its full preview card template in a responsive grid. |
6. Save the listing type.
Configuring Preview Card Columns
When “Preview Cards” is selected as the template, an additional field appears: “Grid columns.”
Enter a number from 1 to 12 to control how many cards appear per row:
| Value | Layout |
|---|---|
1 | Full-width cards (one per row). |
2 | Two cards per row. |
3 | Three cards per row (default, recommended for most layouts). |
4 | Four cards per row. |
6 | Six cards per row. |
The grid is responsive and automatically adjusts for smaller screens:
| Screen Size | Behavior |
|---|---|
| Large screens (≥1200px) | Uses your configured column count. |
| Medium screens (≥992px) | Maximum 3 columns (falls back to 3 if your configured value is higher). |
| Small screens (≥768px) | Always 2 columns. |
| Extra-small screens (<768px) | Always 1 column (full width). |
Tip: Values above 6 may produce very narrow cards that are difficult to read. A value of 3 works well for most layouts.
Merging Related Listing Blocks
If your listing type has multiple Related Listing blocks on the single page, you can merge them into one unified block for a cleaner layout.
1. In the listing type editor, locate the Related Listing blocks you want to combine.
2. On each block, toggle “Merge Blocks” to ON.
3. Assign the same “Merge Block ID” (a number, e.g., 1) to all blocks that should be merged together.
4. Save the listing type.
5. On the frontend single listing page, the first block with that merge ID becomes the visible container, and all listings from subsequent blocks with the same ID are moved into it. The empty subsequent blocks are removed from the page.
Multiple Merge Groups
You can have multiple independent merge groups by using different Merge Block IDs. For example, blocks with ID 1 merge together, and blocks with ID 2 form a separate merged group.
Tip: The merged block inherits the title, icon, and wrapper styling of the first (parent) block. If you want a specific block to be the visible “parent,” ensure it appears first in the block order in the listing type editor.
Example Setup
1. Activate the plugin with the MyListing theme and a child theme active. Templates are automatically copied.
2. Go to Listing Types and edit a listing type (e.g., “Hotels”).
3. Navigate to the Single Page tab.
4. Find the first Related Listing block (e.g., “Nearby Restaurants”). Set Select A Template to Preview Cards, set Grid columns to 3, toggle Merge Blocks ON, and set Merge Block ID to 1.
5. Find the second Related Listing block (e.g., “Nearby Attractions”). Set Select A Template to Preview Cards, set Grid columns to 3, toggle Merge Blocks ON, and set Merge Block ID to 1 (same ID).
6. Save the listing type.
7. Visit a single listing page for this type. Instead of two separate blocks with plain text listings, you see one unified block with rich preview cards from both related listing fields displayed together in a 3-column grid.
Frequently Asked Questions
Does this require a child theme?
Yes. The plugin copies template override files into the child theme directory. Without a child theme, the templates cannot be installed and the plugin will display an error notice.
Is there a settings page?
No. All configuration is done within the MyListing Listing Type Editor. When editing a listing type, find a Related Listing content block — you’ll see new fields for “Select A Template,” “Grid columns,” “Merge Blocks,” and “Merge Block ID.”
What is the difference between “Text” and “Preview Cards”?
Text is the original MyListing layout — a small logo and name for each related listing. Preview Cards renders full MyListing preview cards (the same rich cards shown on explore pages) with images, details, and styling.
How many columns should I use?
A value of 3 works well for most layouts. The grid is responsive — medium screens cap at 3 columns, small screens at 2, and mobile at 1 (full width). Values above 6 produce very narrow cards.
What does “Merge Blocks” do?
If you have multiple Related Listing blocks on a single listing page, merging combines them into one visual block. Enable “Merge Blocks” on each block you want to combine and give them the same “Merge Block ID.” The first block becomes the visible container, and listings from the other blocks are moved into it.
Can I have multiple independent merge groups?
Yes. Use different Merge Block IDs for different groups. Blocks with ID 1 merge together, blocks with ID 2 form a separate group, and so on.
Which block becomes the visible “parent” when merging?
The first block in the block order (as configured in the listing type editor) with that Merge Block ID becomes the visible container. Its title, icon, and wrapper styling are used for the merged result.
What happens to the template files when I deactivate the plugin?
The plugin removes the two template files it copied to your child theme. Reactivating the plugin copies them again. The directory structure remains but the files are deleted.
Will updating the plugin overwrite my customized template files?
Yes. When the plugin detects a version change, it force-copies updated template files to the child theme, overwriting any manual modifications. Back up your customizations before updating.
The preview cards don’t have equal heights — what can I do?
The plugin triggers a layout recalculation after a short delay to equalize card heights. If related listings load slowly, the recalculation may fire too early. Refreshing the page usually resolves the issue.
Does the plugin create any database tables?
No. The plugin stores only a single value in the options table to track the installed template version. Block settings are stored within MyListing’s listing type configuration.
Troubleshooting
New Options Not Appearing in Related Listing Block Settings
| Cause | Solution |
|---|---|
| Templates not installed | Deactivate and reactivate the plugin to trigger template installation. Ensure both the MyListing theme and a child theme are active. |
| Plugin not activated | Go to Plugins → Installed Plugins and verify the plugin is active. |
| MyListing or child theme not active | Both the MyListing theme and a child theme must be active. Check Appearance → Themes. |
Preview Cards Not Displaying on the Frontend
| Cause | Solution |
|---|---|
| “Text” template selected | Edit the listing type, find the Related Listing block, and change “Select A Template” to Preview Cards. |
| No related listings assigned | The listing must have related listings selected in its related listing field. If the field is empty, the block won’t display anything. |
| Related listings not published | Only published listings appear as preview cards. Draft, pending, or expired related listings are excluded. |
| Template files missing | Deactivate and reactivate the plugin to re-copy the template files to the child theme. |
Merged Blocks Not Combining
| Cause | Solution |
|---|---|
| Different Merge Block IDs | All blocks that should merge together must have the same Merge Block ID. Check the ID on each block. |
| “Merge Blocks” not enabled on all blocks | Every block in the merge group must have “Merge Blocks” toggled ON. |
| JavaScript disabled | The merge functionality requires JavaScript. If JavaScript is disabled in the browser, merged blocks will remain hidden. |
| JavaScript error | Check the browser console (F12 → Console) for errors. Conflicts with other scripts can prevent the merge logic from running. |
Preview Card Heights Are Uneven
| Cause | Solution |
|---|---|
| Layout recalculation timing | The plugin triggers a height equalization after a short delay. If related listings load slowly, refreshing the page usually resolves uneven heights. |
| Conflicting CSS | Custom CSS that affects the .grid-item or preview card containers may interfere with height equalization. Check for conflicting styles. |
Template Overwrite Warning
The following template files in your child theme are managed by this plugin and will be overwritten on activation and updates:
includes/src/listing-types/content-blocks/related-listing-block.php
templates/single-listing/content-blocks/related-listing-block.php
Do not customize these files directly — changes will be lost on plugin updates.
“MyListing Theme Not Detected” or “Child Theme Not Detected” Error
The MyListing theme and a child theme must both be installed and active. Go to Appearance → Themes to verify.
For further support, visit codicts.com or contact us at support@codicts.com.