CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   PHP (http://www.codingforums.com/forumdisplay.php?f=6)
-   -   help with shortcode needed (wordpress) (http://www.codingforums.com/showthread.php?t=282400)

OGGordon 11-16-2012 08:11 PM

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

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

Quote:

Originally Posted by mlseim (Post 1292675)
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 :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 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


.

OGGordon 11-16-2012 09:52 PM

Quote:

Originally Posted by mlseim (Post 1292688)
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 :D. Thank you so much!!!


All times are GMT +1. The time now is 06:32 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.