OGGordon
11-16-2012, 08:11 PM
Hey guys,
I'd like to create such a box via shortcode:
http://www.ourtuts.com/how-to-create-wordpress-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
mlseim
11-16-2012, 08:51 PM
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?
OGGordon
11-16-2012, 08:56 PM
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:
This is the text that always should be the same
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 :D.
mlseim
11-16-2012, 09:43 PM
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
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
.
OGGordon
11-16-2012, 09:52 PM
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.
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 :D. Thank you so much!!!