WordPress.org

Forums

Code Snippets
[resolved] shortcode linebreak (8 posts)

  1. BigStache
    Member
    Posted 1 year ago #

    Hello,
    I have created a snippet that makes use of a shortcode. When I use the shortcode there is an extra linebreak before and after the shortcode. Is this something related to how the snippet is read/used?

    http://wordpress.org/plugins/code-snippets/

  2. Shea Bunge
    Member
    Plugin Author

    Posted 1 year ago #

    Have you tested this code directly in a plugin or in functions.php to see if you receive the same result? Can you post your code here so I can chech if it's causing the issue?

  3. BigStache
    Member
    Posted 1 year ago #

    I place the following code in the functions.php

    function TuitionRateShortcode() {
    return '<p>$2.00</p>';
    }
    add_shortcode('tuitionrate', 'TuitionRateShortcode');

    Here is the shortcode in use:

    The current tuition rate is [tuitionrate]. This rate may change from year to year.

    Here is what I get:

    The current tuition rate is

    $2.00

    . This rate may change from year to year.

  4. solhuebner
    Member
    Posted 1 year ago #

    Hi.

    This is due to the <p></p> in your function as it creates a paragraph :)

    Have a look at this website for an example.

    Kind regards

  5. BigStache
    Member
    Posted 1 year ago #

    Fixed thank you!

  6. solhuebner
    Member
    Posted 1 year ago #

    You are welcome :)

  7. Shea Bunge
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks for helping out solhuebner. I would have answered this thread sooner, except the <p> tags from the question were not showing up in the email notification, and I thought that must be a different issue.

  8. solhuebner
    Member
    Posted 1 year ago #

    It is great that you support your plugin so well but I thought it is a good idea to help out when I can as you devs have a lot to do :) And I really like your plugin! It is way easier to handle all that little code snippets used :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic