Parameter in function in shortcode not working
-
Hi,
I have the following code for a shortcode:
function myrelatedpages ( $atts, $content = null ) { extract( shortcode_atts( array( 'pageids' => '', // Set default values ), $atts ) ); $html = wp_list_pages('title_li=&echo=0&sort_column=menu_order&include=$pageids'); return $html; } add_shortcode('myrelatedpages', 'myrelatedpages');
// usage: [myrelatedpages pageids=”5,6″]
The problem is that the $pageids is not being accepted in the wp_list_pages function, ie include=$pageids does not work.
The function does not output anything.
I have tested that $pageids does contain a value, eg: 2553 (a page id) and I have checked that hard coding works eg: include=2553.
Any help would be much appreciated.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Parameter in function in shortcode not working’ is closed to new replies.