Data Publisher demo with WordPress media library integration

BrandBrand TypeColorPhotoAttachmentsPriceLicence PlateCategoryFuel TypeMileageEngine CapacityNo Cylinders
BrandBrand TypeColorPhotoAttachmentsPriceLicence PlateCategoryFuel TypeMileageEngine CapacityNo Cylinders

 

Shortcode arguments used for this demo

[wpdataaccess
pub_id=”3″
]

Image styling

Additional styling to images can be added with CSS. Column names are added to publication cells as classes, which allows you to style every table column differently. If you click on one of the images of the publication, you’ll see that css class bike_photo was added, which is the name of the column holding the image data. To change the width and height of the image we could add the following CSS to this page:

td.bike_photo {
    min-width: auto;
}
td.bike_photo img {
    width: 100px;
    height: 70px;
}

Advanced options

This demo shows an integration of the WordPress media library (read more). It also shows how you can format specific table cells depending on their value. For this example the following line of code was added to column advanced table options in the Data Publisher:

{ "fnRowCallback": "function(row, data, index) { if (data[1]=='Z 800 E ABS') { jQuery(row).find('td:eq(1)').css('color','black'); } else { jQuery(row).find('td:eq(1)').css('color','green'); } }" }

Advanced table options must be written as a JSON string and needs to be on one line. Function fnRowCallback was used in this demo, but the advanced table options column allows you to use any jQuery DataTables option (jQuery DataTable options).

Need help?

Leave a Reply

Your email address will not be published. Required fields are marked *

8 − 3 =