Viewing 15 replies - 1 through 15 (of 15 total)
  • Moderator bcworkz

    (@bcworkz)

    Unless you can prompt the AI to generate articles matching your site’s layout and styling, I think you’d either need to manually cut and paste parts of the content into your template’s blocks, or develop custom CSS for the AI generated content that will cause it to achieve the same layout and style without needing to alter content.

    Thread Starter Zync

    (@zync)

    Thanks a lot, could you explain a bit more (for my understanding) about the custom CSS, so I can make a project of it.

    If you’ve seen raw AI acrticles output, it all looks exactly the same, headers and spaces, badly styled.

    Thanks again

    Moderator bcworkz

    (@bcworkz)

    CSS only works on HTML elements. If the AI output is just straight text with no HTML, you’ll need some sort of intermediate processor that would automatically assign HTML tags to content. To start with you could run it through wpautop(). I’m not sure how code could distinguish sub-titles from regular text. Maybe if there’s only one sentence between newlines that is less than a certain number of characters?

    While an intermediate processor will help you save time, it will not be infallible. Some manual formatting is inevitable. You likely need to insert your own images anyway? Once the HTML is reasonably well structured, CSS could be applied. For example, images could float left or right based on whether their count in content is odd or even, meaning images will alternate left or right justified.

    The challenge is more in developing a decent intermediate processor than applying appropriate CSS.

    I don’t suppose you could ask the AI to write an article that’s already in HTML format? ??

    Thread Starter Zync

    (@zync)

    Thank you so much for giving me a clear perspective on my issue and possible solutions.

    I started the discussion with our favorite content AI https://aiwisemind.com/, and with your permission I’ll keep you posted on developments.

    Moderator bcworkz

    (@bcworkz)

    Yes, I’m interested to hear how things develop. Properly formatting imported data has always been a challenge. Importing AI content isn’t conceptually much different, but what AI might be able to do to help us remains undiscovered at this point.

    Thread Starter Zync

    (@zync)

    Haven’t heard back yet, but spotted an article about hooks, is this relevant and helpful? (I could ask author)

    Introducing Block Hooks for dynamic blocks

    Moderator bcworkz

    (@bcworkz)

    Block hooks could be useful for dynamically fetching content from an alternative source such as an external API. But if you plan on importing AI content into your site so it can be appropriately styled and served from your own server, then block hooks probably would not be useful.

    With either approach the problem remains — how to automatically format generic content so it looks presentable on your site.

    Thread Starter Zync

    (@zync)

    Found some new info on their content exports, which are “in TXT files in HTML format”. Would that work?

    Moderator bcworkz

    (@bcworkz)

    in TXT files in HTML format

    That’s a good start, but is the HTML format the way you want it? Like does it include appropriate H tags for sub-headings? Assuming it’s in a suitable format, then you basically fetch the file and place its contents on your page. In PHP it may be as simple as echo file_get_contents('https://example.com/the-file-i-want.txt'); added to a template file.

    It won’t really be that simple, but that’s the gist of what needs to happen.

    Thread Starter Zync

    (@zync)

    I was hoping for that response from you, I’ll dig further thanks! 

    I have a batch and single here https://drive.google.com/drive/folders/1_WPmXzJdC8s6GJkVExGRB84mgFCwapxz?usp=share_link, maybe you could have a look?

    There’s isn’t software that could change code directly in that TXT file, to upload those nicely aligned with our style and templates? (If it works that way at all)

    Moderator bcworkz

    (@bcworkz)

    Well, CSV files aren’t exactly the same as TXT files, so importing is a little more involved. But the bonus in doing so is you get useful supporting data like title and description. I suggest using one of the CSV importer plugins to import files like this.

    The content field is HTML format, so it ought to be somewhat presentable as-is. But to match your site’s layout and styling you will likely need some additional CSS. This could be rather tricky if the imported HTML is lacking attribute values you could use to style certain elements a certain way.

    If simple CSS alone proves to be inadequate it would be possible to have code that alters the content by algorithm so it can be better styled. But naturally the things that need to be changed need to be consistent in some way so the algorithm can distinguish what to change from what not to change.

    It may be some things will be too difficult to accomplish automatically. You’d then either need to live with what it is or manually correct things as necessary.

    Thread Starter Zync

    (@zync)

    Thank you for rounding this up for me into a solid working theory (that even makes sense to me), and I got the CSV importer to test: https://www.ads-software.com/support/topic/best-way-to-transfer-content-from-site-to-site/ 

    Could you say if this is something new I’m trying to achieve? To me it seems ultimately required to publish ‘stylishly’, directly from AI (plugins as well as connected) to site, isn’t it? 

    I’ll write a job with your approach, start with CSS. For the best results I’m counting on hand-editing, but I want to see if and how close we can get to ‘aesthetically generated and automated’. How long would a first go at this take you think?

    I’d like to invite you (if appropriate), but would already be thankful if you could look into some finished code I could show you here? 

    Thread Starter Zync

    (@zync)

    One more thing for my understanding; we apply our styling and preferences ‘retroactively’ in-website correct? Inserting our HTML directly into the exported CSV file (and then import) isn’t a consideration right?

    Moderator bcworkz

    (@bcworkz)

    Importing CSV data has been a need from the beginning. But of course importing generative content is relatively new.

    The difficulty is in getting imported content to match the layout and styling of your site. Every site is different so the exact specific approach has to likewise be specific to the site.

    The first step is to import some sample content so you know what you have to work with. You may want to do some preliminary processing that you know you’ll need, such as wrapping the entire content in the same div containers your theme normally uses. Or maybe wrap content in a div with a unique class attribute so that you can target your imported content with CSS that would not affect the rest of your site.

    Then develop CSS that best achieves the style and layout you want. You may find some aspects are difficult style because of what you have to work with. Determine what you’d need to get to your goals. Can this be somehow automated by algorithm? Then great, develop it! If it’s something that has to be done manually, are you willing to make the effort, or can you live without?

    How long would this all take? I don’t know. There are too many variables at play.

    I would be interested to see what you end up with. If you get stuck on something along the way, I’d be willing try and help out. But I suggest creating a new topic in these forums because others might be in a better position than I to help with a particular problem.

    Good luck and happy coding ??

    Thread Starter Zync

    (@zync)

    You’ve given me the right comprehension of all the moving parts, thanks so much again this could have been a big hangup for me.

    I’ll start putting it into action and carve my way, close the ticket for now and update you with news.

    All the best.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Generated Content Into Post Templates’ is closed to new replies.