DotDragnet
February 08, 2012, 08:03:17 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Mobile users - Our forum is Tapatalk enabled. http://www.tapatalk.com/
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Wordpress shortcodes  (Read 614 times)
net-curtains
Guest
« on: June 25, 2010, 11:40:09 AM »

Just creating a shortcode that creates a box around selected content. I've been following the tutorial here: http://www.tuttoaster.com/how-to-use-style-and-implement-wordpress-shortcodes/

It kind of works, but I'm getting an unwanted ';' at the beginning of the text in the box.

Here's the code for the functions.php file:

Code:
function box($atts, $content = null) {
return '<div class="box">;'.$content.'</div>';
}
add_shortcode('box', 'box');

I've played around with it a bit, and did mange to lose the additional character but it also broke the WP admin as a side effect.

Any help appreciated  biggrin

Logged
Charisma Bypass
Hero Member
*****
Posts: 511



View Profile Awards
« Reply #1 on: June 25, 2010, 12:02:09 PM »

return '<div class="box">;'.$content.'</div>';

should be

return '<div class="box">' . $content . '</div>';

Punch yourself in the nuts. banana
Logged
Rosco
Global Moderator
Hero Member
*****
Posts: 907



View Profile Awards
« Reply #2 on: June 25, 2010, 12:21:37 PM »

big grin
Logged
net-curtains
Guest
« Reply #3 on: June 25, 2010, 12:23:21 PM »

return '<div class="box">;'.$content.'</div>';

should be

return '<div class="box">' . $content . '</div>';

Punch yourself in the nuts. banana

I thought it was that, that was the bit I changed which fixed the resulting html but sent WP bonkers. Looks like I must have had something else wrong in the functions code as it's all fine now. The bit pasted above though is copied directly from the tutorial.

Thanks - nuts punched!


« Last Edit: June 25, 2010, 12:25:06 PM by net-curtains » Logged
sevyanfellow
Guest
« Reply #4 on: July 22, 2010, 10:33:31 AM »

i use wordpress framwork for blog creation can you tell me how i connect my blog with mysql database
Logged
sickpuppy
Site Chimp
Administrator
Hero Member
*****
Posts: 1863



sickpuppysoftwa
View Profile WWW Awards
« Reply #5 on: July 23, 2010, 09:12:44 AM »

i use wordpress framwork for blog creation can you tell me how i connect my blog with mysql database

Did you follow their own installation instructions?

http://codex.wordpress.org/Installing_WordPress
Logged

Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2006-2008, Simple Machines Valid XHTML 1.0! Valid CSS!