• HI,
    I want to know if there there’s any way to do the automation of wp post. Such as i will be just writing the title and the title automatically will be in the body.

    Example
    post title: “Hi my name is jason”
    Post Body: “Hi my name is jason” (Auto generate, I don’t want to write again inside, I have managed to make the auto post, but i can’t put the same text as title in the body, looking for some helpful links/guide)

    Thanks

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

    (@bcworkz)

    Why repeat the title in content? (Redundant data is a pet peeve of mine) If there is a legitimate need to always repeat the title in content, the theme template ought to be modified to include the title when content is output. For example:

    <h1><?php the_title(); ?></h1>
    <div class="content"><?php echo get_the_title() .' - '. get_the_content(); ?></div>

    It’s also easier to do than modifying default editor content.

    Thread Starter jasoninjx

    (@jasoninjx)

    Hi, thanks,
    as I have mentioned i have around 50-60 automated post every day, So, I am looking for a way to make it auto also.

    My content body is empty now, So, I just want something to be there so the title.

    Which file I should edit to place these codes to try that you provided?
    function.php?

    Moderator bcworkz

    (@bcworkz)

    You can automatically add the posts title to page content as it is output by using “the_content” filter. Filter hooks and callbacks can go in a theme’s functions.php.

    You will not see the title as content in the editor, but on the front end it’ll appear with content.

    add_filter('the_content', function( $content ){
       return get_the_title() .' - '. $content;
    });
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WP Writing Automation’ is closed to new replies.