Run shortcode inside another shortcode…

Just a quick little tutorial about how to run one shortcode from inside another.
In theory you could nest these as deep as you wanted to…

Here’s the new shortcode that we want to run inside the old shortcode:

function mynamespace_new(){
$mynamespace_content = '';
$mynamespace_content .= 'do your shortcode functions here';
return $mynamespace_content;
}
add_shortcode('mynamespace_new', 'mynamespace_new');

And here is the old shortcode with the new shortcode running inside it:

function mynamespace_old(){
$mynamespace_content = '';
$mynamespace_content .= do_shortcode('[mynamespace_new]');
return $mynamespace_content;
}
add_shortcode('mynamespace_old', 'mynamespace_old');

Quick and Easy. That’s all for now…
Ray

Posted in Tutorials, WordPress | Leave a comment

Protests Break Out Across Europe Saturday! Join Us to Stop ACTA & TPP!

Protests Break Out Across Europe Saturday! Join Us to Stop ACTA & TPP!

6 Reasons to oppose ACTA

  1. ACTA locks countries into obsolete copyright and patent laws. If a democracy decides on less restrictive laws that reflect the reality of the internet, ACTA will prevent that.
  2. ACTA criminalizes users by making noncommercial, harmless remixes into crimes if “on a commercial scale” (art 2.14.1). Many amateur works achieve a commercial scale on sites like Youtube. ACTA, like SOPA, could mean jail time for the Justin Biebers of the world.
  3. ACTA Criminalizes legitimate websites, making them responsible for user behavior by “aiding and abetting”. (art 2.14.4). Like SOPA, the founders of your favorite sites could be sued or (worse) thrown in jail for copyright infringement by their users.
  4. ACTA will let rightsholders use laughably inflated claims of damages (based on the disproven idea that every download or stream is a lost sale) to sue people. As if suing amazing artists, video makers and websites for millions wasn’t hard enough!
  5. ACTA Permanently bypasses democracy by giving the “ACTA Committee” the power to “propose amendments to [ACTA]” (art 6.4). In other words, voting for ACTA writes a blank check to an unelected committee. These closed-door proceedings will be a playground for SOPA-supporters like the MPAA.
  6. Trade agreements are a gaping loophole, a backdoor track that, even though it creates new law, is miles removed from democracy. It’s a secretive process that’s tailor-made to serve politically connected companies. And the movie studios behind SOPA? They’re experts at it. If we can’t make secretive trade agreements harder to pass than US law, our internet’s future belongs to the lobbyists behind SOPA.

From La Quadrature du Net

Posted in Uncategorized | Leave a comment

Think Like A Hacker

So a friend sends you an email warning you about a virus that’s spreading around.
It says something like:

URGENT!! PLEASE CIRCULATE THIS NOTICE TO YOUR FRIENDS, FAMILY, CONTACTS!

Being the great friend you are you imediately forward the email to all your friends.
Here’s what the hackers know: If you get that email you will never open it in a million years BUT
you will forward the warning email to everyone you know!!

Guess what kids? It’s the warning email that contains the virus!! Read it closely.
You’ll notice the english is not so good. And if you click on that link that looks like a youtube link
you’re pretty much screwed. See the little paperclip up in the left hand corner that says URGENT.dat ?

It must be ok to click that because your best friend sent you the email. WRONG, IT’s A VIRUS silly.
But curiousity killed the cat and the Hackers know this…

Another thing you might notice about the email, it’s not signed by anybody. Gee, I wonder why??

Do yourself and all your friends a favor and share this post on your wall…
and please, please, please think really long and hard before you forward any email…

I hope this may help somebody from losing all their stuff or maybe prevent that $350 trip to the computer repair place!

Your Friend
Ray Peaslee

Posted in Uncategorized | Leave a comment

WordPress, tinyMCE and Custom Forms

So I’m working on a new plugin and it needs a custom form to collect and save settings. It has a couple of textareas so I’m thinking “how cool will it be to add tinyMCE to the textareas? People will love it.” Visual editing, no coding knowledge required.

It was pretty easy to add tinyMCE to the form. I stopped by the codex and found the wp_editor function. This was too easy. I gave it a name, added the variable with the content and pressed save. I reloaded the page and tada! There it was. I had the visual editor on my form the first try!

Ok, so by now I’m thinking I’m God of the internet. Then I loaded my carefully crafted post. Hey all looked good. “I think I’ll just press save and see what happens”

This would be the point where the shit actually hit the fan

All my styles style=" " all my paragraphs <p></p> and all my line breaks  <br /> were gone. What a mess! Here’s the part that did work. My form worked like a charm and happily saved all the screwed up code! As luck would have it, I always, always backup and I thank God for that.

So off I go to Google and the forums in search of answers. Ok, so it wasn’t just me. Everybody is bitchin. If I had only read Customize_TinyMCE_with_Filters first.

I did however finally get it working and here is what I’ve found:

  • You’re gonna need a good stripper!

When adding the value to your form use stripslashes. tinyMCE is gonna add slashes so before you display the form value you’re going to need to remove them.

So instead of:
<?php wp_editor( $content, $editor_id, $settings = array() ); ?>

You need to do:
<?php wp_editor( stripslashes($content), $editor_id, $settings = array() ); ?>

Reloaded my default settings and like magic all my styles were back and I didn’t lose them when saving.

  •  About that paragraph , <p> Thing.

Just don’t. Make it a division, <div>  instead. You will save yourself so much stress. You can use a <span> inside a division as well and you won’t lose your changes. One more thing about using the <p> tag, Just don’t…

  • Gimme a break <br />.

Sorry, with the default settings it’s not gonna happen and it’s not worth the aggravation.
Just use <div style="display:block;"> instead. You can also do it with a <span> . And css margins are your friend.

In the end the editor is working well. I did jump over to the html side a couple of times while writing this post but 98% was done on the visual side. I think it’s important to get it working because not everyone who uses it on your site is going to be a programmer.

That’s it for now, my brain is tired. See you next time.
Ray

Posted in Plugins, WordPress | 1 Comment

WordPress html email

Just a few words regarding sending html email with WordPress 3.3. The function  wp_mail() is located at wp-includes/pluggable.php line 203. It is a pluggable function so you can over ride it with a plugin. I use it as is. Here is the basic call:

wp_mail( $to, $subject, $message, $headers = '', $attachments = array() );

To send html email add the following line just above wp_mail:
add_filter('wp_mail_content_type',create_function('', 'return "text/html";'));

So your call to send html email should look like this:

add_filter('wp_mail_content_type',create_function('', 'return "text/html";'));
wp_mail( $to, $subject, $message, $headers = '', $attachments = array() );

And of course the $message variable has to be valid html.
That’s it for now. Have a great day.
Ray

Posted in WordPress | Leave a comment