Currently set to generate articles with 3 images from prompt and 3 text blocks (200-500) words long.
Can be easly configured in template.py
Taking prompts (Locations) in from loc.txt
Using OpenAI and Bing API.
Installs
- python
pip install openai
pip install bing_image_urls
In template.py add wordpress API
ROOT = 'https://website.com' #Your Website
user = 'Username' #Your Username
password = 'Password' #Application Password
#Password Section User>Profile>Add New Password Name
In AIAPI.py add OpenAI API
openai.api_key = "sk-KEY" #OpenAI key
model_engine = "text-davinci-003" #model
Word press REST API for python doesnt have the ability to post the IMG as a featured IMG. All featured IMG plugins either have a pay wall or outdated the best way to fix this is FTP Using the php script below and following the steps from gavickPro you can insert this fucntion in a wordPress theme. https://www.gavick.com/blog/wordpress-automatically-set-post-featured-image It can possibly break your website use test site or child site to test
function wpsites_auto_set_featured_image() {
global $post;
if (!has_post_thumbnail($post->ID)) {
$attached_image = get_children(array(
'post_parent' => $post->ID,
'post_type' => 'attachment',
'post_mime_type' => 'image',
'numberposts' => 1
));
if ($attached_image) {
foreach ($attached_image as $attachment_id => $attachment) {
set_post_thumbnail($post->ID, $attachment_id);
break;
}
}
}
}
add_action('save_post', 'wpsites_auto_set_featured_image');
This plug in works but needs to be updated to set featured img https://wordpress.org/plugins/auto-featured-image-from-title/
Block Error Try this
article_block = f'<p>{article_block_content_1}</p><figure class="wp-block-image"><img src="{img1}" alt=""/></figure><p>{addtion_block_prompt_2}</p><figure class="wp-block-image"><img src="{img2}" alt=""/></figure><p>{addtion_block_prompt_3}</p><figure class="wp-block-image"><img src="{img3}" alt=""/></figure><p>{addtion_block_prompt_4}</p>'
Source: https://wordpress.com/support/wordpress-editor/block-error-unexpected-or-invalid-content/
Add in functions.php
add_theme_support( 'post-thumbnails');