[wp-hackers] My plugin doesn't work online :( Shortcode loadingorder?!
Otto
otto at ottodestruct.com
Mon Mar 26 22:48:25 UTC 2012
The shortcode isn't processed until the header has already finished
and you're displaying the content later on the page. Better to enqueue
scripts and such into the footer if you have to do it that way.
However, I was really referring more to your includes and lack of a
"return" on the shortcode. That's your main problem.
-Otto
On Mon, Mar 26, 2012 at 5:15 PM, Diana K. Cury <dianakac at gmail.com> wrote:
> Thanks Otto,
>
> I'm using the do_action to put content on header when using the shortcode, I
> don't really know how could I put scripts, css and else only when the
> shortcode is being used only. Is there someway?
>
>
>
>
>
> ----- Original Message ----- From: "Otto" <otto at ottodestruct.com>
> To: <wp-hackers at lists.automattic.com>
> Sent: Monday, March 26, 2012 4:38 PM
> Subject: Re: [wp-hackers] My plugin doesn't work online :( Shortcode
> loadingorder?!
>
>
>
> On Mon, Mar 26, 2012 at 1:56 PM, Diana K. Cury <dianakac at gmail.com> wrote:
>>
>> Sorry for bother,
>>
>> I just can't understand why my plugin isn't working, the post type screen
>> is ok, but the shortcode action does'nt work at all.
>>
>> When adding [mensagem], it supposed to add the form into the page, but
>> anything show up when doing so :(
>> ...
>> add_shortcode( 'mensagem', 'mensagem_shortcode',6 );
>> ...
>> //cria shortcode
>> function mensagem_shortcode() {
>> do_action('wp_head','mensagem_form');
>> include('form.php');
>> }
>
>
>
> Shortcodes are never, ever, supposed to produce output. They're
> supposed to *return* output.
>
> A shortcode is, basically, a filter.
>
> Give this a quick read:
> http://ottopress.com/2011/actions-and-filters-are-not-the-same-thing/
>
> Also, that isn't how do_action works. Not sure what you're trying to
> do there, actually.
>
> -Otto
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
More information about the wp-hackers
mailing list