Do something like this.
// your shortcode callback
function your_sc_callback($atts,$content) {
$content = wp_list_pages(array('echo'=>false)).$content;
define('YOUR_SC_RAN',true);
return $content;
}
Now, in your theme template after the content prints
if (!defined('YOUR_SC_RAN')) {
wp_list_pages();
}
Or, you could do …
function append_list_pages($content) {
return $content.wp_list_pages(array('echo'=>false));
}
add_filter('the_content','append_list_pages',100);
And your shortcode callback would be …
function your_sc_callback($atts,$content) {
$content = wp_list_pages(array('echo'=>false)).$content;
remove_filter( 'the_content','append_list_pages',100 );
return $content;
}
Both or these are untested, so no guarantees, but I think either should work.
Related Posts:
- apply_filters(‘the_content’, $content) vs do_shortcode($content)
- How to get shortcode’s input values inside a filter?
- Filter specific shortcode output?
- Insert Custom HTML After Shortcode
- Is there a way to add another row to the tinyMCE kitchen sink toggle?
- add_filter and changing output captions of image gallery
- How to add attribute to output with wp_video_shortcode add_filter
- Search content for shortcodes and get parameters
- Change default settings used by gallery shortcode
- Shortcodes not resolved in AJAX call response
- Ajax, filters and shortcodes
- Format content value from DB outside of WordPress filters
- Use content custom filter for all shortcodes
- wp_link_pages output appears twice
- How to link current user to their author page through shortcodes
- filter title from shortcode
- how to remove filter from wordpress shortcode output
- Error when overriding only some audio shortcode HTML output
- How to use shortcode attribute in separate function
- add_filter(‘the_content’, ‘…’) stops pagination from working
- Shortcodes — Using add_action, add_filter in the shortcode
- How to pass variables to custom filter from multiple functions
- How to filter backend post list showing only posts having a shortcode
- How can I return shortcode output to the top of the content?
- the_excerpt filter doesn’t work as expected
- run shortcode in excerpt of single custom post type
- Filter everything from content except output of a shortcode
- Something is filtering my shortcodes… Can’t figure out what
- How to use do_shortcode_tag to modify the output of a shortcode?
- Shortcodes within the sidebar text/html widget: How to preserve the raw HTML output of the shortcode?
- How to change dynamically page title according to variable data?
- How can I filter tag_description()?
- WordPress removing slashes from shortcode output
- How to remove shortcode(s) from WYSIWYG Page editor for Non Admins
- Shortcode / plugin with custom (flexible) output
- Filter Shortcodes when using get_page
- Parse a shortcode differently based on on what it’s nested in
- Need to return shortcode text instead of the output
- add_filter to the_content after apply_filters
- post_orderby filter breaks function
- the_content getting current page content instead specified ID
- Removing menus from users other than the administrator
- Override wordpress audio playlist
- How to wrap pattern-matches from the_content in [wiki]-shortcode tags
- Add Index to Item in WordPress Gallery
- create a shortcode with acf including a filter
- How to take shortcode and content separately from a page?
- Auto-generated excerpt with shortcode and read more button/text link
- How to make the show as a button?
- shortcode function outputs multiple anchor tags
- apply_filters to $GLOBALS
- Change shortcode output (filter?)
- Is it possible to include the add_filter() function within a shortcode function
- Activate short codes for all post queries?
- Problem with shortcodes in external file
- How to Pass External Variables to Filters/Actions
- Filter username field on registration for profanity and unwanted words
- At what priority does add_filter overwrite core functions?
- How to add icons to post listing (edit.php) in admin
- Tiny MCE editor stripping xlink:href parameter from SVG USE tag
- Keep Users Logged In As Long As I Like
- Is it possible to remove the filter from 4.8 text widget?
- How to remove X-Frame-Options: SAMEORIGIN” from WordPress?
- Setting title using wp_title filter
- What hook/filter can I use to add/edit/show/hide the title under (on hover) links on the table view?
- option_active_plugins filter not working
- How do we check if the user is logging in or registering?
- Anonymous function is executed twice in wp_head while added from the_posts filter?
- add_filter return value
- Why my admin doesn’t work after adding rest_prepare_post filter?
- How do I filter title and alt attributes in the gallery shortcode?
- remove_action in plugin file
- How to apply filter at search of woocommerce products?
- Filtering post-formats from the loop using new WP-Query();
- How to add a filter to get_the_author_meta?
- What different ways can a plugin add a filter to a WordPress site?
- Make an array filterable per hook
- how to use force_filtered_html_on_import in add_filter?
- Filter Hook callback error, is it due to using $this inside a filter or something else?
- Disadvantage of using filters & hooks multiple times
- How To Override A WooCommerce AJAX Function
- Get The Caller (Plugin / Theme / Core) For All actions & Hook in WordPress
- How to trim white space in search terms?
- Changing the argument of a function
- Remove pretty photo style and script if not exist!
- custom gallery filter with image caption as link title?
- The gettext hook doesnt work on text with links
- “The editor has encountered an unexpected error” After add defer tag to java script
- Hook to add content after date in post?
- Create different flavours of excerpt
- Search with filters
- How to remove the post pagination (Next page tag) depending on type of traffic source: from utm_campain or non-utm_campain
- How do I disable the warning “The backup of this post in your browser is different from the version below”?
- Change url to posts if they have custom tax only
- How to get to the date of the uploaded file
- Can’t get content of all (19) posts – Incomplete Chunked Encoding
- Customize register form page with add_action or apply_filter
- Is it possible to make get variable out of filter in Class?
- NextGEN Gallery: Adding drop-down menu widget to gallery view without modifying plugin code [closed]
- How to Dynamically Switch WordPress Front Page Without Causing Canonical Redirect?