Skip to content

Reload current opage shortcode

I have placed this in a form response to trigger a page reload.



function reload_page_shortcode( $atts = null, $content = null ) {

	/*
$output = <<<EOF
<div id="reload-shortcode-app">
<select class="browser-default" v-model="qParams">
<option value="">Default</option>
$content
</select>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.9/vue.min.js"></script>
<script>
var vue = new Vue({
        el: '#reload-shortcode-app',
        data: {
                qParams: window.location.search.split('?')[1] ? window.location.search.split('?')[1] : ''
        },
        watch: {
                qParams: function(newParams) {
                        var url = location.href.split('?')[0] + '?' + newParams;
                        location.href = url;
                }
        }
});
</script>
EOF;
	
	*/

//return $output;

	
	wp_redirect( get_permalink() );
	
	exit;
	
}

add_shortcode('reload-page', 'reload_page_shortcode');

Dieser Beitrag hat 0 Kommentare

Schreibe einen Kommentar

Deine E-Mail wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

An den Anfang scrollen