Support » Plugin: Subpage List » Add echo = false to shortcode_atts

  • Resolved Gabriel Serafini

    (@gserafini)


    I really like this plugin, thank you for writing it. A simple thing I know, but very useful. At some point, they added an echo flag (defaulted to true) to the wp_list_pages function.

    This results now in the contents of the shortcode getting outputted at the top of the post or page it’s being used in, rather than in the correct place the shortcode was placed.

    Adding this to the plugin code shortcode_atts fixes it:

    'echo' => false,

    Please consider adding this to the plugin so it’s available for everyone.

    Thanks!

    Complete function here:

    
     public function subpage_view($atts)
            {
            global $wp_query;
    
                    return wp_list_pages(shortcode_atts(array(
                            'depth'        => 0,
                            'show_date'    => '',
                            'date_format'  => get_option('date_format'),
                            'child_of'     => $wp_query->queried_object->ID,
                            'exclude'      => '',
                            'title_li'     => '',
                            'authors'      => '',
                            'sort_column'  => 'menu_order, post_title',
                            'link_before'  => '',
                            'link_after'   => '',
                'exclude_tree' => '',
                'post_type'    => 'page',
                'post_status'  => 'publish',
                'item_spacing' => 'preserve',
                'walker'       => '',
                'echo' => false,
                    ), $atts));
            }
    
    • This topic was modified 1 year, 9 months ago by Gabriel Serafini. Reason: Added suggested fix in context
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add echo = false to shortcode_atts’ is closed to new replies.