WordPress.org

Ready to get started?Download WordPress

Forums

[shortcodes] problem with $atts (3 posts)

  1. CallMeAndy
    Member
    Posted 2 years ago #

    Obviously something here is not correct but I just cant see it any help appreciated.

    The code is executing as it should accept that immediately after entry to ABNet_handler_blogs_newest(), inspection is showing a null terminated string for $atts. Why would the params not be passed to the handler?

    [netblogsnewest count=2 total=true]

    add_action("after_setup_theme", "ABNet_handler_blogs_newest", 15);
    
    add_shortcode('netblogsnewest','ABNet_handler_blogs_newest');
    
    function ABNet_handler_blogs_newest( $atts ) {
        if( !is_multisite() ) return false;
    
        extract( shortcode_atts( array(
                    'count' => '',
                    'total' => '',
               ), $atts )
         );
         return ABNet_output_blogs_newest($count, $total);
    
    }
  2. keesiemeijer
    moderator
    Posted 2 years ago #

    Not sure but why do you use the after_setup_theme action hook for this? I don't think it's needed.

  3. CallMeAndy
    Member
    Posted 2 years ago #

    keesiemeijer - I am sure you are correct that it is not required - a lack of understanding on my part and not enough time to scrutanise every aspect of examples drawn upon. I have been including this construct for all shortcodes as it seemed to be required on the first that I did, and it has never caused obstruction since.

    Please feel free to enlighten me about its purpose.

    Removing it has made no difference to this not working of course.

    Andy

Topic Closed

This topic has been closed to new replies.

About this Topic