add a line to each new article (4 posts)

  1. stijnvth
    Posted 4 years ago #

    Is there way i can add a adjustable line to each article?

    Basically all my articles start with this line:

    <p align="right">Source: ---- </p>
    these ---- should be adjustable offcourse to what my source was. The enters are there cause that way it looks prettier.

    Now i have to manually type this but is there a way when i click on 'New article' that this line is already in place?

    Or like add a button when i click on it that piece of text is placed in the article?
    Something like that?

  2. stijnvth
    Posted 4 years ago #

    small corrections the line of text isn't entirely right
    it should be <br/><br/><p align="right"><strong>Source:</strong> ----</p>

    It got changed cause i forgot the code tags.

  3. stijnvth
    Posted 4 years ago #

    anybody? basically like in this forum that in the message text field there is a pre-written line of tekst basically the above HTML code? Someone who can help me, please?

  4. SpankMarvin
    Posted 4 years ago #

    If I understand correctly, you're best off using custom fields.

    Create a new custom field below the content editor called Source.

    Then, above the_content(); function in your template, add:

    $source = get_post_meta( $post->ID, "Source", true);
    if( $source ) {
      echo( '<br /><br /><p class="source">Source: ' . esc_html( $source ) . '</p>');

    etc etc.

    Note I removed the inline alignment. Use a class instead, and apply the right align and bold to p.source instead. This makes future revisions more universal.


Topic Closed

This topic has been closed to new replies.

About this Topic