post_content
field of the wp_posts
table in the database. Enough styling information is included in the HTML, in the form of classes or inline styles, to allow the page or post to be rendered in the browser accurately simulating the appearance as it was in the editor.<Global />
component.content.rendered
property delivered by the REST API, but unfortunately some of these shortcodes can appear verbatim in the content that comes from the REST API.<Global />
component. In most cases this should result in a fairly accurate rendering of the pages or posts in Frontity. However, the benefits of CSS in JS are lost with this approach and adding several style sheets to the project using the <Global />
component will potentially result in reduced performance of the site.<html2react>
package, and in particular the section on processors..css
files that the page builder uses, and also illustrate using a processor to dynamically process elements.webBrowser
processor.has-browser-window
class.content.rendered
property received from the REST API. We can therefore simply parse this HTML with the html2react
component to identify the elements we want to process.webBrowser
processor tests whether the element has the has-browser-window
class and if so executes the processor function which adds a top bar to the element to create the effect of being in a browser window:<Topbar>
component which renders the actual top-bar. It then adds it as the first element in the node's children
array (using unshift). Adding it as the first element in the array ensures that it will appear above the remaining child elements, creating the browser window effect.theme.css
and style.css
. These files can be found in the ./wp-includes/css/dist/block-library
directory of your WordPress installation. Copy them across to a location in your Frontity theme, e.g. to a sub-directory called styles
.index.js
file of your Frontity theme and add them using the <Global>
component.html2react
is particularly pertinent here and contains further examples.frontend.min.CSS
file which is located in the wp-content/plugins/elementor/assets/css/
directory.wp-content/uploads/elementor/css
. In particular you will need global.css
from this directory.<Theme>
component in your theme's index.js
file:wp-content/uploads/elementor/css
directory. These will usually each be specific to a particular page or post.<Global />
component. Adding stylesheets in this way can potentially affect the performance of the site..css
files from Elementor in this way in order to accurately reproduce the look and feel of the content in your Frontity project, so keep in mind the potentially adverse effect of this on the performance of your site.<body>
tag. However, you can add these same classes to the <body>
tag of your Frontity project using the <Head>
component.<Head>
component into your theme's index.js
file and then use it in your main <Theme>
component passing it a bodyAttributes
prop containing an object with the classes that you want in your <body>
tag.<body>
tag there. WordPress itself adds certain classes, and your WordPress theme may well be adding classes of it's own.elementor-
, however a trial-and-error approach is needed here to see which classes added to the <body>
tag produce the desired result in the browser.<Head>
components to your theme. You will need to manually refresh your browser in order to see the new classes added to the <body>
tag.