Data Content Publisher

Complete WordPress Plugin Help Guide

Available Shortcodes

[dcpub_template]
Displays data using a template. You can target a single entry or render multiple entries by conditions.

Basic Usage

[dcpub_template id="1" title="Entry Title"] [dcpub_template id="1" dbid="smartphones" col_1="Apple" gt__col_3="500"] [dcpub_template id="1" dbid="smartphones" fields="title,col_5,col_6" fields_sep=" / " title="iPhone 16"]

Available Attributes

AttributeDescription
idTemplate ID (required)
titleEntry title (optional)
entry_idEntry ID (optional)
dbidDatabase ID or database name for shared templates
fieldsComma-separated field list for simple output
fields_sepSeparator used with fields
orderbyField to sort by (default: id)
orderSort order (ASC/DESC, default: ASC)
limitNumber of matched entries to render
emptyCustom text shown when nothing matches
sort_presetAttached sort/filter preset ID
allAllows all entries to be rendered when no conditions are provided
Canonical Style
Use quoted attributes as the standard form: [dcpub_template id="456" title="Entry Title"]
Unquoted values may work in some cases, but quoted attributes are the recommended syntax.
[dcpub_lookup]
Retrieves and displays entry values from the specified database. Returns the field value from the first entry that matches the conditions.

Basic Usage

[dcpub_lookup db="1" col_1="Value" field="field_to_display"]

Available Attributes

AttributeDescription
dbDatabase ID (required)
fieldField name to retrieve (optional)
Basic Example
[dcpub_lookup db="1" col_1="Fire Sword" field="col_3"]
Displays the value of the col_3 field for the entry where col_1 is "Fire Sword" in database ID 1.
Prefix Conditions (New)
Supports OR searches with multiple values and advanced condition matching. You can use these prefixes with shortcodes such as template and dbid.

Supported Operators

PrefixMeaningExample
in__OR condition (match any value)in__title="A,B,C"
not_in__NOT IN conditionnot_in__col_1="Consumable,Material"
like__Partial matchlike__title="Sword"
gt__Greater thangt__col_5="100"
gte__Greater than or equalgte__col_5="100"
lt__Less thanlt__col_5="500"
lte__Less than or equallte__col_5="500"
between__Range conditionbetween__col_5="100,500"
or__Raw OR-style value conditionor__col_1="A|B"

Special Values

image_url="fill" col_8="blank"
Use fill and blank on normal fields to check whether a value exists.
Basic OR Condition
[dcpub_template id="1" in__title="Fire Sword,Ice Sword,Thunder Sword"]
Displays entries whose title matches any of the listed values.
Combining Multiple Conditions
[dcpub_template id="1" in__title="Sword,Axe" col_1="Weapon" gte__col_5="100"]
Displays entries where the title matches the OR condition, col_1 is "Weapon", and col_5 is 100 or more.
Range Condition
[dcpub_template id="1" between__col_5="100,500" col_1="Armor"]
Displays entries where col_5 is between 100 and 500 and col_1 is "Armor".
Also Available in the dbid Shortcode
[dcpub_lookup db="193" in__title="Sword A,Sword B" field="col_5"]
Retrieves the field from the entry whose title matches any of the listed values.
[dcpub_calc]
Processes calculation formulas that use entry fields and displays the result.
[dcpub_calc]col_1+col_2*col_3[/dcpub_calc]
[if]
Displays content using conditional branching. The closing tag is [endif].
[if col_1="value"]True case[else]False case[endif]
[repeat]
Retrieves multiple entries that match the specified conditions and displays them in a loop.
[repeat db="1" col_1="Value"]Repeated content[endrepeat]

Template Syntax Guide

Basic Field References

[title] - Entry title [col_1] - Value of column 1 [col_2] - Value of column 2 [id] - Entry ID

Recommended Workflow

  1. Build the visual layout in Gutenberg or Elementor first.
  2. Copy the HTML into the template editor.
  3. Replace static text with DCP fields such as [title], [col_1], and [image_url].
  4. Add DCP logic only where needed: [if], [repeat].
  5. Keep nesting shallow. If the template becomes too complex, revise the database structure instead.

DCP is not a visual page builder. The most natural workflow is to design first, then convert the static parts into DCP variables and logic.

Conditional Branching (if)

Basic Conditions

[if col_1="Weapon"]This is a weapon[endif] [if col_2=fill]Value exists[else]No value[endif] [if col_3>100]Greater than 100[endif]

Multiple Conditions

[if col_1="Weapon"&col_2="Rare"]This is a rare weapon[endif] [if col_1="Weapon"|col_1="Armor"]This is equipment[endif]

Modulo Conditions

[if _counter%3=0]Display every third item[endif] [if _counter%2=1]Display on odd-numbered items[endif]

Loop and Section Tags

[repeat db="1" col_1="Value"]... [endrepeat] [before]... [end_before] [after]... [end_after]

Control-style tags use explicit closing names such as [endif], [endrepeat], [end_before], and [end_after].

Repeat nesting is supported up to 3 levels. For readability and performance, 2 levels or fewer are recommended.

Deep nesting can become heavy when control tags are combined. Save validation and preview warnings will alert you when nesting becomes too deep.

Link Tag

[link="url"]Buy now[/link] [link="[url]"]Open page[/link]

Both direct values and variable-style values are supported. [link="url"] is the simplest canonical example.

Special Variables

VariableDescription
[_total]Total number of search results
[_counter]Current item number (starts from 1)
[_first]"true" for the first item
[_last]"true" for the last item
[_odd]"true" for odd-numbered items
[_even]"true" for even-numbered items

Common Templates

A practical template collection you can use with copy and paste.

Icon + Title Link

Displays the image and title, and turns them into a link when a URL exists.

[if url=fill]
  [link="url"]
  [image_url width="50"]<br>
  [title]
  [/link]
[else]
  [image_url width="50"]
  <br>[title]
[endif]

Icon Only

Displays only the image, and turns it into a link when a URL exists.

[if url=fill]
  [link="url"]
  [image_url width="50"]
  [/link]
[else]
  [image_url width="50"]
[endif]

Three-Column Wrap

Displays icons and titles in a wrapping three-column layout. Requires the Flexible Table Block plugin.

[before]<!-- wp:flexible-table-block/table -->
<figure class="wp-block-flexible-table-block-table"><table class="has-fixed-layout"><tbody><tr>
[end_before]
<td style="text-align:center">
  [if url=fill]
    [link="url"]
    [image_url width="50"]<br>
    [title]
    [/link]
  [else]
    [image_url width="50"]
    <br>[title]
  [endif]
</td>
[if _counter%3=0]
</tr><tr>
[endif]
[after]
</tr>
</tbody></table></figure>
<!-- /wp:flexible-table-block/table -->
[end_after]

Note: _counter%3=0 inserts a line break every third item. Change the number if you want a different column count.

Sort & Filter Guide

Overview

This feature lets you interactively sort and filter table data on the front end. Because it runs in JavaScript, filtering happens instantly without page reloads.

Creating Sort Presets

You can create reusable filter settings from the Sort Settings screen in the admin area.

Filter Types

TypeDescriptionUse Case
Type Selection Filter A dropdown filter that can search multiple columns with OR/AND logic Pokemon type, weapon category, and similar use cases
Condition Filter A checkbox-style filter based on specific column values "Show Mega Evolution only", "Rare equipment only", and similar cases

Using Presets in Shortcodes

Specify the sort preset you created in a shortcode.

Basic Usage

[dcpub_template id="1" sort_preset="pokemon"]
Displays the filter UI for the preset ID named "pokemon".

Setting the data-sort Attribute

Important: You must manually add the data-sort attribute to table headers (<th>). Filtering will not work without it.

How to Define data-sort

<th data-sort="col_4">Type 1</th> <th data-sort="col_5">Type 2</th> <th data-sort="col_7">No</th>

The Sort Settings edit screen displays copy-ready data-sort attribute examples. Copy them and paste them into your template header.

Complete Template Example

This example creates a table similar to a Pokemon index.

Template Content

[before]<!-- wp:flexible-table-block/table -->
<figure class="wp-block-flexible-table-block-table"><table class="has-fixed-layout"><tbody><tr>
<th style="text-align:center;width:10%" data-sort="col_7">No</th>
<th style="text-align:center">Pokemon</th>
<th style="text-align:center" data-sort="col_4">Type</th>
<th style="text-align:center">Base Stats</th>
</tr>
[end_before]
<tr>
  <th style="width:10%;text-align:center">[col_7]</th>
  <td style="text-align:center">
    [if url=fill]
      [link="url"]
      [image_url width="100"]<br>
      [title]
      [/link]
    [else]
      [image_url width="100"]
      <br>[title]
    [endif]
  </td>
  <td style="text-align:center">[dcpub_template id="41" title="[col_4]"][dcpub_template id="41" title="[col_5]"]</td>
  <td style="text-align:center">[col_9]-[col_10]-[col_11]-[col_12]-[col_13]・・col_14]・・lt;/td>
</tr>
[after]
</tbody></table></figure>
<!-- /wp:flexible-table-block/table -->
[end_after]

Note: Please use full-width parentheses ・茨シ・ Some patterns containing half-width parentheses () may be falsely blocked by WAF.

Shortcode

[dcpub_template id="1" sort_preset="pokemon"]

Map Embed (Google Maps)

To embed Google Maps in your template, set the column type to Map when creating the database.

How to use

  1. In your database, add a column and set its type to Map.
  2. In the entry editor, paste the Google Maps embed code (<iframe>) into the Map column. The plugin automatically extracts the URL.
  3. In the template, use the column variable (e.g. [col_3]) to output the map.

Template Examples

[col_3]
Outputs a responsive 16:9 map at full width.
[col_3 width="600px"]
Fixed width of 600px.
[col_3 ratio="75%"]
4:3 aspect ratio instead of 16:9.

Getting the Embed Code

  1. Open Google Maps and find the location.
  2. Click Share 竊・Embed a map.
  3. Copy the entire <iframe> code and paste it into the entry cell.

You can also paste just the embed URL directly. No API key is required.

OR Search and AND Search

Type selection filters let you choose the search mode.

ModeDescriptionExample
OR Search Matches when any target column matches Contains "Fire" in col_4 or col_5
AND Search Requires all target columns to match Contains "Fire" in both col_4 and col_5

How to Get Filter Options

Filter choices can be configured in two ways.

1. Auto-load from the DB

After selecting a target column, click the "Load from DB" button to automatically fetch all existing values from that column.

2. Add Manually

You can add choices one by one with the "Add Manually" button. You can specify the value, label, and icon URL.

Value: Fire Label: Fire Type Icon URL: https://example.com/fire-icon.png

Troubleshooting

Nothing happens when I click a filter button

  • Make sure the data-sort attribute is correctly set on the table headers
  • Check the browser console (F12) for errors

All entries disappear

  • Make sure the column names used in data-sort match your actual data
  • Make sure the columns configured in the filter match the columns used in the template

The template cannot be saved

  • Some patterns containing half-width parentheses () (for example [col_14])) may be falsely blocked by WAF
  • Please change them to full-width parentheses ・茨シ・/code>

Notes

  • data-sort must be set manually: It is not added automatically, so you must write it in the template yourself
  • JavaScript-based: It runs on the client side after page load, not on the server side
  • Requires all entries to be loaded: To use filtering, the shortcode must retrieve all entries
  • Gutenberg comments are preserved: Structures such as <!-- wp:heading {"level":3} --> are preserved when saving

Programmatic Article Generation

Use one template and one database to generate many articles, then update them later from the database.

Title Pattern

[Review] [title] strengths, weaknesses, and recommendation

Body Example

[dcpub_template id="140" title="[title]"]

Why this is useful

  • Create many pages from one structure
  • Update output by editing the template or DB
  • Useful for pSEO, affiliate pages, and data-driven sites

Future-Proof Placeholder Output

If data is not ready yet, you can still build the page structure first and let the query text show as a fallback.

Example

[dcpub_template id="88" title="iPhone 20" display="1"]

This is useful when the product or character name is known first, but the detailed database row will be added later.