Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
My plugin doesn't work online :( Shortcode loading order?!
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Diana K. Cury  
View profile  
 More options Mar 26 2012, 2:56 pm
From: "Diana K. Cury" <diana...@gmail.com>
Date: Mon, 26 Mar 2012 15:56:04 -0300
Local: Mon, Mar 26 2012 2:56 pm
Subject: [wp-hackers] My plugin doesn't work online :( Shortcode loading order?!
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 :(

<?php
/**
 * Plugin Name: Simple Messages
 * Plugin URI: http://dianakcury.com/sm
 * Description: Permite que visitantes envie mensagens, sem usar PHP Mailer ou SMTP.
 * Version: 0.2
 * Author: Diana K. Cury
 * Author URI: http://dianakcury.com
 * License: GPLv2 or later
 */

    require_once 'creation.php';

    add_action( 'init', 'msg_custom_init',2 );
    add_action( 'admin_print_styles', 'action_admin_print_styles', 3 );
    add_filter( 'manage_' . 'msg' . '_posts_columns', 'filter_manage_msg_posts_columns',4 );
    add_action( 'manage_posts_custom_column',  'action_manage_posts_custom_columna' , 5, 2 );

    add_shortcode( 'mensagem', 'mensagem_shortcode',6 );
    add_filter('get_header','wp_sd',7);
    add_filter('get_header','mensagem_form',8);

//cria shortcode
function mensagem_shortcode() {
    do_action('wp_head','mensagem_form');
    include('form.php');
  }

function mensagem_form() {
    include('form-action.php');
  }

//imprime estilos
function wp_sd($result) {
 wp_enqueue_style('extra_st', WP_PLUGIN_URL . "/simple-messages/style.css");

}

?>
_______________________________________________
wp-hackers mailing list
wp-hack...@lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Otto  
View profile  
 More options Mar 26 2012, 3:38 pm
From: Otto <o...@ottodestruct.com>
Date: Mon, 26 Mar 2012 14:38:14 -0500
Local: Mon, Mar 26 2012 3:38 pm
Subject: Re: [wp-hackers] My plugin doesn't work online :( Shortcode loading order?!
On Mon, Mar 26, 2012 at 1:56 PM, Diana K. Cury <diana...@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-hack...@lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "My plugin doesn't work online :( Shortcode loadingorder?!" by Diana K. Cury
Diana K. Cury  
View profile  
 More options Mar 26 2012, 6:15 pm
From: "Diana K. Cury" <diana...@gmail.com>
Date: Mon, 26 Mar 2012 19:15:29 -0300
Local: Mon, Mar 26 2012 6:15 pm
Subject: Re: [wp-hackers] My plugin doesn't work online :( Shortcode loadingorder?!
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?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Otto  
View profile  
 More options Mar 26 2012, 6:48 pm
From: Otto <o...@ottodestruct.com>
Date: Mon, 26 Mar 2012 17:48:25 -0500
Local: Mon, Mar 26 2012 6:48 pm
Subject: Re: [wp-hackers] My plugin doesn't work online :( Shortcode loadingorder?!
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 <diana...@gmail.com> wrote:

_______________________________________________
wp-hackers mailing list
wp-hack...@lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »