Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Oct 2009
    Location
    GERMANY
    Posts
    140
    Thanks
    29
    Thanked 1 Time in 1 Post

    help with shortcode needed (wordpress)

    Hey guys,

    I'd like to create such a box via shortcode:
    http://www.ourtuts.com/how-to-create...ss-shortcodes/

    However, I want it to be "self closing" and with a text that I don't have to type everytime I want that box to appear. How can I make that??

    TIA

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,509
    Thanks
    8
    Thanked 1,090 Times in 1,081 Posts
    Are you describing something like displaying the green info box (with the checkmark and some text on it) and then after some time (like 5 seconds) it disappears automatically?

  • #3
    Regular Coder
    Join Date
    Oct 2009
    Location
    GERMANY
    Posts
    140
    Thanks
    29
    Thanked 1 Time in 1 Post
    Quote Originally Posted by mlseim View Post
    Are you describing something like displaying the green info box (with the checkmark and some text on it) and then after some time (like 5 seconds) it disappears automatically?
    No, I meant that I want the text inside that green box with the check mark to always be the same, so I don't have to retype it over and over.

    The way how the shortcode works is like this:

    [success] This is the text that always should be the same [/success]

    But I want to only type: [success] and the text should automatically appear without me typing it again. Hope I explained it thoroughly, my english is a little bad .

  • #4
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,509
    Thanks
    8
    Thanked 1,090 Times in 1,081 Posts
    I'm sort of guessing on this one ... my untested example below.

    You should have the CSS style defined in your .css file for .successCSS

    .successCSS{
    font-family: arial;
    font-size: 20px;
    }
    in your style sheet properties ... you would have borders, padding, background img, etc ...


    Put this in your "functions.php" file located in your theme directory.
    PHP Code:

    <?php 
    function success_shortcode() {    
    return 
    '<div class="successCSS">This is the text that always should be the same.</div>';
    }
    add_shortcode('success''success_shortcode'); 
    ?>
    Then in your post ....

    Blah Blah Blah
    [success]
    Blah Blah Blah


    .
    Last edited by mlseim; 11-16-2012 at 09:49 PM.

  • Users who have thanked mlseim for this post:

    OGGordon (11-16-2012)

  • #5
    Regular Coder
    Join Date
    Oct 2009
    Location
    GERMANY
    Posts
    140
    Thanks
    29
    Thanked 1 Time in 1 Post
    Quote Originally Posted by mlseim View Post
    I'm sort of guessing on this one ... my untested example below.

    You should have the CSS style defined in your .css file for .successCSS

    .successCSS{
    font-family: arial;
    font-size: 20px;
    }
    in your style sheet properties ... you would have borders, padding, background img, etc ...


    Put this in your "functions.php" file located in your theme directory.
    PHP Code:

    it works :D. Thank you so much!!!!

    <?php 
    function success_shortcode() {    
    return 
    '<div class="successCSS">This is the text that always should be the same.</div>';
    }
    add_shortcode('success''success_shortcode'); 
    ?>
    Then in your post ....

    Blah Blah Blah
    [success]
    Blah Blah Blah


    .
    it works . Thank you so much!!!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •